‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Collection\AbstractRecordCollection Class Reference
Inheritance diagram for TYPO3\CMS\Core\Collection\AbstractRecordCollection:
TYPO3\CMS\Core\Collection\RecordCollectionInterface TYPO3\CMS\Core\Collection\RecordCollectionInterface TYPO3\CMS\Core\Collection\PersistableCollectionInterface TYPO3\CMS\Core\Collection\SortableCollectionInterface TYPO3\CMS\Core\Collection\CollectionInterface TYPO3\CMS\Core\Collection\CollectionInterface TYPO3\CMS\Core\Collection\NameableCollectionInterface TYPO3\CMS\Core\Collection\CollectionInterface TYPO3\CMS\Core\Collection\CollectionInterface TYPO3\CMS\Core\Collection\NameableCollectionInterface TYPO3\CMS\Core\Category\Collection\CategoryCollection TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection 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 TYPO3\CMS\Core\Tests\Unit\Resource\Collection\Fixtures\OtherTestingFileCollection TYPO3\CMS\Core\Tests\Unit\Resource\Collection\Fixtures\TestingFileCollection TYPO3\CMS\Core\Resource\Collection\CategoryBasedFileCollection TYPO3\CMS\Core\Resource\Collection\FolderBasedFileCollection TYPO3\CMS\Core\Resource\Collection\StaticFileCollection TYPO3\CMS\Core\Tests\Unit\Resource\Collection\Fixtures\OtherTestingFileCollection TYPO3\CMS\Core\Tests\Unit\Resource\Collection\Fixtures\TestingFileCollection

Public Member Functions

 __construct ()
 
T null current ()
 
 next ()
 
int string key ()
 
bool valid ()
 
 rewind ()
 
 __serialize ()
 
 __unserialize (array $arrayRepresentation)
 
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 CollectionInterface load ($id, $fillItems=false)
 
static 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 $storageItemsField = 'items'
 
static string $storageTableName = ''
 

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_file_collections and is manageable via FormEngine.

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

@template T <T>

Definition at line 39 of file AbstractRecordCollection.php.

Constructor & Destructor Documentation

◆ __construct()

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

Creates this object.

Definition at line 86 of file AbstractRecordCollection.php.

Member Function Documentation

◆ __serialize()

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

Returns class state to be serialized.

Definition at line 141 of file AbstractRecordCollection.php.

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

◆ __unserialize()

TYPO3\CMS\Core\Collection\AbstractRecordCollection::__unserialize ( array  $arrayRepresentation)

Load records with the given serialized information

Definition at line 151 of file AbstractRecordCollection.php.

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

◆ count()

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

Count elements of an object

Returns
‪int The custom count as an integer.

Definition at line 161 of file AbstractRecordCollection.php.

◆ create()

static 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
CollectionInterface

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

Definition at line 317 of file AbstractRecordCollection.php.

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

◆ current()

T null TYPO3\CMS\Core\Collection\AbstractRecordCollection::current ( )

Return the current element

Returns
‪T|null

Definition at line 96 of file AbstractRecordCollection.php.

◆ fromArray()

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

◆ getCollectionDatabaseTable()

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

Definition at line 408 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 368 of file AbstractRecordCollection.php.

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

Referenced by 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, 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 181 of file AbstractRecordCollection.php.

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

◆ key()

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

Return the key of the current element

Returns
‪int|string 0 on failure.

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

Definition at line 114 of file AbstractRecordCollection.php.

◆ load()

static 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
CollectionInterface

Implements TYPO3\CMS\Core\Collection\PersistableCollectionInterface.

Definition at line 297 of file AbstractRecordCollection.php.

References TYPO3\CMS\Core\Collection\AbstractRecordCollection\create(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

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 260 of file AbstractRecordCollection.php.

◆ next()

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

Move forward to next element

Definition at line 104 of file AbstractRecordCollection.php.

◆ persist()

◆ rewind()

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

Rewind the Iterator to the first element

Definition at line 133 of file AbstractRecordCollection.php.

◆ 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 211 of file AbstractRecordCollection.php.

References TYPO3\CMS\Redirects\Message\description.

◆ 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 281 of file AbstractRecordCollection.php.

◆ setItemTableName()

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

Setter for the name of the data-source table

Parameters
string$tableName

Implements TYPO3\CMS\Core\Collection\RecordCollectionInterface.

Definition at line 231 of file AbstractRecordCollection.php.

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

◆ setTitle()

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

Setter for the title

Parameters
string$title

Implements TYPO3\CMS\Core\Collection\NameableCollectionInterface.

Definition at line 201 of file AbstractRecordCollection.php.

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

◆ toArray()

◆ 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 245 of file AbstractRecordCollection.php.

◆ valid()

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

Checks if current position is valid

Returns
‪bool The return value will be cast to boolean and then evaluated.

Definition at line 125 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 75 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 45 of file AbstractRecordCollection.php.

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

◆ $storageTableName

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

The table name collections are stored to, must be defined in the subclass

Definition at line 51 of file AbstractRecordCollection.php.

◆ $title

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

◆ $uid

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