‪TYPO3CMS  10.4
TYPO3\CMS\Core\Collection\AbstractRecordCollection Class Reference
Inheritance diagram for TYPO3\CMS\Core\Collection\AbstractRecordCollection:
TYPO3\CMS\Core\Collection\RecordCollectionInterface TYPO3\CMS\Core\Collection\PersistableCollectionInterface TYPO3\CMS\Core\Collection\SortableCollectionInterface TYPO3\CMS\Core\Collection\CollectionInterface TYPO3\CMS\Core\Collection\NameableCollectionInterface TYPO3\CMS\Core\Category\Collection\CategoryCollection TYPO3\CMS\Core\Collection\StaticRecordCollection TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection TYPO3\CMS\Frontend\Category\Collection\CategoryCollection TYPO3\CMS\Core\Resource\Collection\CategoryBasedFileCollection TYPO3\CMS\Core\Resource\Collection\FolderBasedFileCollection TYPO3\CMS\Core\Resource\Collection\StaticFileCollection

Public Member Functions

 __construct ()
 
mixed current ()
 
 next ()
 
int key ()
 
bool valid ()
 
 rewind ()
 
string serialize ()
 
mixed unserialize ($serialized)
 
int count ()
 
string getTitle ()
 
int getUid ()
 
string getDescription ()
 
 setTitle ($title)
 
 setDescription ($desc)
 
string getItemTableName ()
 
 setItemTableName ($tableName)
 
 usort ($callbackFunction)
 
 moveItemAt ($currentPosition, $newPosition=0)
 
int getIdentifier ()
 
 setIdentifier ($id)
 
 persist ()
 
array toArray ()
 
 fromArray (array $array)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Collection\PersistableCollectionInterface
 loadContents ()
 

Static Public Member Functions

static TYPO3 CMS Core Collection CollectionInterface load ($id, $fillItems=false)
 
static TYPO3 CMS Core Collection CollectionInterface create (array $collectionRecord, $fillItems=false)
 

Protected Member Functions

array getPersistableDataArray ()
 
string getItemUidList ($includeTableName=true)
 

Static Protected Member Functions

static getCollectionDatabaseTable ()
 

Protected Attributes

int $uid = 0
 
string $title
 
string $description
 
string $itemTableName
 
SplDoublyLinkedList $storage
 

Static Protected Attributes

static string $storageTableName = 'sys_collection'
 
static string $storageItemsField = 'items'
 

Detailed Description

Abstract implementation of a RecordCollection

RecordCollection is a collections of TCA-Records. The collection is meant to be stored in TCA-table sys_collections and is manageable via TCEforms.

A RecordCollection might be used to group a set of records (e.g. news, images, contentElements) for output in frontend

The AbstractRecordCollection uses SplDoublyLinkedList for internal storage

Definition at line 35 of file AbstractRecordCollection.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::__construct ( )

Creates this object.

Definition at line 82 of file AbstractRecordCollection.php.

Member Function Documentation

◆ count()

int TYPO3\CMS\Core\Collection\AbstractRecordCollection::count ( )

(PHP 5 >= 5.1.0) Count elements of an object

int The custom count as an integer.

Definition at line 182 of file AbstractRecordCollection.php.

◆ create()

static TYPO3 CMS Core Collection CollectionInterface TYPO3\CMS\Core\Collection\AbstractRecordCollection::create ( array  $collectionRecord,
  $fillItems = false 
)
static

Creates a new collection objects and reconstitutes the given database record to the new object.

Parameters
array$collectionRecordDatabase record
bool$fillItems‪Populates the entries directly on load, might be bad for memory on large collections
Returns
‪\TYPO3\CMS\Core\Collection\CollectionInterface

Reimplemented in TYPO3\CMS\Core\Category\Collection\CategoryCollection, TYPO3\CMS\Frontend\Category\Collection\CategoryCollection, and TYPO3\CMS\Core\Collection\StaticRecordCollection.

Definition at line 338 of file AbstractRecordCollection.php.

Referenced by TYPO3\CMS\Core\Collection\AbstractRecordCollection\load().

◆ current()

mixed TYPO3\CMS\Core\Collection\AbstractRecordCollection::current ( )

(PHP 5 >= 5.1.0) Return the current element

mixed Can return any type.

Definition at line 94 of file AbstractRecordCollection.php.

◆ fromArray()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::fromArray ( array  $array)

Loads the properties of this collection from an array

Parameters
array$array

Reimplemented in TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection, and TYPO3\CMS\Core\Resource\Collection\FolderBasedFileCollection.

Definition at line 424 of file AbstractRecordCollection.php.

◆ getCollectionDatabaseTable()

static TYPO3\CMS\Core\Collection\AbstractRecordCollection::getCollectionDatabaseTable ( )
staticprotected

Definition at line 432 of file AbstractRecordCollection.php.

◆ getDescription()

◆ getIdentifier()

◆ getItemTableName()

◆ getItemUidList()

string TYPO3\CMS\Core\Collection\AbstractRecordCollection::getItemUidList (   $includeTableName = true)
protected

Generates comma-separated list of entry uids for usage in DataHandler

also allow to add table name, if it might be needed by DataHandler for storing the relation

Parameters
bool$includeTableName
Returns
‪string

Reimplemented in TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection.

Definition at line 390 of file AbstractRecordCollection.php.

References TYPO3\CMS\Core\Collection\AbstractRecordCollection\getItemTableName().

Referenced by TYPO3\CMS\Core\Collection\StaticRecordCollection\getPersistableDataArray(), and TYPO3\CMS\Core\Category\Collection\CategoryCollection\getPersistableDataArray().

◆ getPersistableDataArray()

array TYPO3\CMS\Core\Collection\AbstractRecordCollection::getPersistableDataArray ( )
abstractprotected

Returns an array of the persistable properties and contents which are processable by DataHandler.

For internal usage in persist only.

Returns
‪array

Reimplemented in TYPO3\CMS\Core\Category\Collection\CategoryCollection, TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection, TYPO3\CMS\Core\Collection\StaticRecordCollection, and TYPO3\CMS\Core\Resource\Collection\FolderBasedFileCollection.

Referenced by TYPO3\CMS\Core\Collection\AbstractRecordCollection\persist().

◆ getTitle()

◆ getUid()

int TYPO3\CMS\Core\Collection\AbstractRecordCollection::getUid ( )

Getter for the UID

Returns
‪int

Definition at line 202 of file AbstractRecordCollection.php.

References TYPO3\CMS\Core\Collection\AbstractRecordCollection\$uid.

◆ key()

int TYPO3\CMS\Core\Collection\AbstractRecordCollection::key ( )

(PHP 5 >= 5.1.0) Return the key of the current element

int 0 on failure.

Reimplemented in TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection.

Definition at line 117 of file AbstractRecordCollection.php.

◆ load()

static TYPO3 CMS Core Collection CollectionInterface TYPO3\CMS\Core\Collection\AbstractRecordCollection::load (   $id,
  $fillItems = false 
)
static

Loads the collections with the given id from persistence

For memory reasons, per default only f.e. title, database-table, identifier (what ever static data is defined) is loaded. Entries can be load on first access.

Parameters
int$id‪Id of database record to be loaded
bool$fillItems‪Populates the entries directly on load, might be bad for memory on large collections
Returns
‪\TYPO3\CMS\Core\Collection\CollectionInterface

Implements TYPO3\CMS\Core\Collection\PersistableCollectionInterface.

Definition at line 318 of file AbstractRecordCollection.php.

References TYPO3\CMS\Core\Collection\AbstractRecordCollection\create().

Referenced by TYPO3\CMS\Core\Collection\AbstractRecordCollection\unserialize().

◆ moveItemAt()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::moveItemAt (   $currentPosition,
  $newPosition = 0 
)

Moves the item within the collection

the item at $currentPosition will be moved to $newPosition. Omitting $newPosition will move to top.

Parameters
int$currentPosition
int$newPosition

Implements TYPO3\CMS\Core\Collection\SortableCollectionInterface.

Definition at line 281 of file AbstractRecordCollection.php.

◆ next()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::next ( )

(PHP 5 >= 5.1.0) Move forward to next element

https://php.net/manual/en/iterator.next.php

Definition at line 105 of file AbstractRecordCollection.php.

◆ persist()

◆ rewind()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::rewind ( )

(PHP 5 >= 5.1.0) Rewind the Iterator to the first element

https://php.net/manual/en/iterator.rewind.php

Definition at line 141 of file AbstractRecordCollection.php.

◆ serialize()

string TYPO3\CMS\Core\Collection\AbstractRecordCollection::serialize ( )

◆ setDescription()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::setDescription (   $desc)

Setter for the description

Parameters
string$desc

Implements TYPO3\CMS\Core\Collection\NameableCollectionInterface.

Reimplemented in TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection.

Definition at line 232 of file AbstractRecordCollection.php.

◆ setIdentifier()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::setIdentifier (   $id)

Sets the identifier of the collection

Parameters
int$id

Implements TYPO3\CMS\Core\Collection\PersistableCollectionInterface.

Definition at line 302 of file AbstractRecordCollection.php.

◆ setItemTableName()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::setItemTableName (   $tableName)

◆ setTitle()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::setTitle (   $title)

Setter for the title

Parameters
string$title

Implements TYPO3\CMS\Core\Collection\NameableCollectionInterface.

Definition at line 222 of file AbstractRecordCollection.php.

References TYPO3\CMS\Core\Collection\AbstractRecordCollection\$title.

◆ toArray()

◆ unserialize()

mixed TYPO3\CMS\Core\Collection\AbstractRecordCollection::unserialize (   $serialized)

◆ usort()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::usort (   $callbackFunction)

Sorts collection via given callBackFunction

The comparison function given as must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

Parameters
callable$callbackFunction
See also
http://www.php.net/manual/en/function.usort.php

Implements TYPO3\CMS\Core\Collection\SortableCollectionInterface.

Definition at line 266 of file AbstractRecordCollection.php.

◆ valid()

bool TYPO3\CMS\Core\Collection\AbstractRecordCollection::valid ( )

(PHP 5 >= 5.1.0) Checks if current position is valid

bool The return value will be casted to boolean and then evaluated.

Definition at line 130 of file AbstractRecordCollection.php.

Member Data Documentation

◆ $description

string TYPO3\CMS\Core\Collection\AbstractRecordCollection::$description
protected

◆ $itemTableName

string TYPO3\CMS\Core\Collection\AbstractRecordCollection::$itemTableName
protected

Table name of the records stored in this collection

Definition at line 71 of file AbstractRecordCollection.php.

Referenced by TYPO3\CMS\Core\Collection\AbstractRecordCollection\getItemTableName().

◆ $storage

SplDoublyLinkedList TYPO3\CMS\Core\Collection\AbstractRecordCollection::$storage
protected

◆ $storageItemsField

string TYPO3\CMS\Core\Collection\AbstractRecordCollection::$storageItemsField = 'items'
staticprotected

The table name collections are stored to

Definition at line 47 of file AbstractRecordCollection.php.

Referenced by TYPO3\CMS\Core\Category\Collection\CategoryCollection\getStorageItemsField().

◆ $storageTableName

string TYPO3\CMS\Core\Collection\AbstractRecordCollection::$storageTableName = 'sys_collection'
staticprotected

The table name collections are stored to

Definition at line 41 of file AbstractRecordCollection.php.

◆ $title

string TYPO3\CMS\Core\Collection\AbstractRecordCollection::$title
protected

◆ $uid

int TYPO3\CMS\Core\Collection\AbstractRecordCollection::$uid = 0
protected