‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Category\Collection\CategoryCollection Class Reference
Inheritance diagram for TYPO3\CMS\Core\Category\Collection\CategoryCollection:
TYPO3\CMS\Core\Collection\AbstractRecordCollection TYPO3\CMS\Core\Collection\EditableCollectionInterface 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\Frontend\Category\Collection\CategoryCollection

Public Member Functions

 __construct ($tableName=null, $fieldName=null)
 
 loadContents ()
 
 add ($data)
 
 addAll (CollectionInterface $other)
 
 remove ($data)
 
 removeAll ()
 
array getItems ()
 
 setRelationFieldName ($field)
 
string getRelationFieldName ()
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Collection\AbstractRecordCollection
 __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)
 

Static Public Member Functions

static CategoryCollection create (array $collectionRecord, $fillItems=false)
 
static CategoryCollection load ($id, $fillItems=false, $tableName='', $fieldName='')
 
static string getStorageTableName ()
 
static string getStorageItemsField ()
 
- ‪Static Public Member Functions inherited from ‪TYPO3\CMS\Core\Collection\AbstractRecordCollection
static CollectionInterface load ($id, $fillItems=false)
 

Protected Member Functions

QueryBuilder getCollectedRecordsQueryBuilder ()
 
array getCollectedRecords ()
 
array getPersistableDataArray ()
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Core\Collection\AbstractRecordCollection
string getItemUidList ($includeTableName=true)
 

Protected Attributes

string $relationFieldName = 'categories'
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Core\Collection\AbstractRecordCollection
int $uid = 0
 
string $title
 
string $description
 
string $itemTableName
 
SplDoublyLinkedList $storage
 

Static Protected Attributes

static string $storageTableName = 'sys_category'
 
- ‪Static Protected Attributes inherited from ‪TYPO3\CMS\Core\Collection\AbstractRecordCollection
static string $storageItemsField = 'items'
 
static string $storageTableName = ''
 

Additional Inherited Members

- ‪Static Protected Member Functions inherited from ‪TYPO3\CMS\Core\Collection\AbstractRecordCollection
static getCollectionDatabaseTable ()
 

Detailed Description

Category Collection to handle records attached to a category

Definition at line 31 of file CategoryCollection.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::__construct (   $tableName = null,
  $fieldName = null 
)

Creates this object.

Parameters
string$tableName‪Name of the table to be working on
string$fieldName‪Name of the field where the categories relations are defined
Exceptions

Definition at line 52 of file CategoryCollection.php.

References TYPO3\CMS\Core\Collection\AbstractRecordCollection\setItemTableName(), and TYPO3\CMS\Core\Category\Collection\CategoryCollection\setRelationFieldName().

Member Function Documentation

◆ add()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::add (   $data)

◆ addAll()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::addAll ( CollectionInterface  $other)

Adds a set of entries to the collection

Implements TYPO3\CMS\Core\Collection\EditableCollectionInterface.

Definition at line 245 of file CategoryCollection.php.

References TYPO3\CMS\Core\Category\Collection\CategoryCollection\add().

◆ create()

static CategoryCollection TYPO3\CMS\Core\Category\Collection\CategoryCollection::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
CategoryCollection

Reimplemented from TYPO3\CMS\Core\Collection\AbstractRecordCollection.

Reimplemented in TYPO3\CMS\Frontend\Category\Collection\CategoryCollection.

Definition at line 73 of file CategoryCollection.php.

Referenced by TYPO3\CMS\Core\Tests\Functional\Category\Collection\CategoryCollectionTest\canCreateDummyCollection(), TYPO3\CMS\Core\Tests\Functional\Category\Collection\CategoryCollectionTest\canCreateDummyCollectionAndFillItems(), and TYPO3\CMS\Core\Category\Collection\CategoryCollection\load().

◆ getCollectedRecords()

array TYPO3\CMS\Core\Category\Collection\CategoryCollection::getCollectedRecords ( )
protected

Gets the collected records in this collection, by using <getCollectedRecordsQueryBuilder>.

Returns
‪array

Reimplemented in TYPO3\CMS\Frontend\Category\Collection\CategoryCollection.

Definition at line 185 of file CategoryCollection.php.

References TYPO3\CMS\Webhooks\Message\$record, and TYPO3\CMS\Core\Category\Collection\CategoryCollection\getCollectedRecordsQueryBuilder().

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

◆ getCollectedRecordsQueryBuilder()

QueryBuilder TYPO3\CMS\Core\Category\Collection\CategoryCollection::getCollectedRecordsQueryBuilder ( )
protected

Selects the collected records in this collection, by looking up the MM relations of this record to the table name defined in the local field 'table_name'.

Returns
‪QueryBuilder

Definition at line 130 of file CategoryCollection.php.

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

Referenced by TYPO3\CMS\Frontend\Category\Collection\CategoryCollection\getCollectedRecords(), and TYPO3\CMS\Core\Category\Collection\CategoryCollection\getCollectedRecords().

◆ getItems()

array TYPO3\CMS\Core\Category\Collection\CategoryCollection::getItems ( )

Gets the current available items.

Returns
‪array

Definition at line 284 of file CategoryCollection.php.

◆ getPersistableDataArray()

array TYPO3\CMS\Core\Category\Collection\CategoryCollection::getPersistableDataArray ( )
protected

Returns an array of the persistable properties and contents which are processable by DataHandler. for internal usage in persist only.

Returns
‪array

Reimplemented from TYPO3\CMS\Core\Collection\AbstractRecordCollection.

Definition at line 223 of file CategoryCollection.php.

References TYPO3\CMS\Core\Collection\AbstractRecordCollection\getDescription(), TYPO3\CMS\Core\Collection\AbstractRecordCollection\getItemUidList(), and TYPO3\CMS\Core\Collection\AbstractRecordCollection\getTitle().

◆ getRelationFieldName()

string TYPO3\CMS\Core\Category\Collection\CategoryCollection::getRelationFieldName ( )

Gets the name of the categories relation field

Returns
‪string

Definition at line 309 of file CategoryCollection.php.

References TYPO3\CMS\Core\Category\Collection\CategoryCollection\$relationFieldName.

◆ getStorageItemsField()

static string TYPO3\CMS\Core\Category\Collection\CategoryCollection::getStorageItemsField ( )
static

◆ getStorageTableName()

static string TYPO3\CMS\Core\Category\Collection\CategoryCollection::getStorageTableName ( )
static

◆ load()

static CategoryCollection TYPO3\CMS\Core\Category\Collection\CategoryCollection::load (   $id,
  $fillItems = false,
  $tableName = '',
  $fieldName = '' 
)
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
string$tableName‪Name of table from which entries should be loaded
string$fieldName‪Name of the categories relation field
Returns
CategoryCollection

Reimplemented in TYPO3\CMS\Frontend\Category\Collection\CategoryCollection.

Definition at line 99 of file CategoryCollection.php.

References TYPO3\CMS\Core\Category\Collection\CategoryCollection\create(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Category\Collection\CategoryCollection\removeAll().

Referenced by TYPO3\CMS\Core\Tests\Functional\Category\Collection\CategoryCollectionTest\canLoadADummyCollectionFromDatabase(), TYPO3\CMS\Core\Tests\Functional\Category\Collection\CategoryCollectionTest\canLoadADummyCollectionFromDatabaseAfterRemoveOneRelation(), TYPO3\CMS\Core\Tests\Functional\Category\Collection\CategoryCollectionTest\canLoadADummyCollectionFromDatabaseAndAddRecord(), and TYPO3\CMS\Core\Tests\Functional\Category\Collection\CategoryCollectionTest\canLoadADummyCollectionWithoutContentFromDatabase().

◆ loadContents()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::loadContents ( )

Populates the content-entries of the storage Queries the underlying storage for entries of the collection and adds them to the collection data. If the content entries of the storage had not been loaded on creation ($fillItems = false) this function is to be used for loading the contents afterwards.

Implements TYPO3\CMS\Core\Collection\PersistableCollectionInterface.

Definition at line 207 of file CategoryCollection.php.

References TYPO3\CMS\Core\Category\Collection\CategoryCollection\add(), TYPO3\CMS\Core\Category\Collection\CategoryCollection\getCollectedRecords(), and TYPO3\CMS\Core\Category\Collection\CategoryCollection\removeAll().

◆ remove()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::remove (   $data)

Removes the given entry from collection Note: not the given "index"

Parameters
mixed$data

Implements TYPO3\CMS\Core\Collection\EditableCollectionInterface.

Definition at line 258 of file CategoryCollection.php.

◆ removeAll()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::removeAll ( )

Removes all entries from the collection collection will be empty afterwards

Implements TYPO3\CMS\Core\Collection\EditableCollectionInterface.

Definition at line 274 of file CategoryCollection.php.

Referenced by TYPO3\CMS\Core\Category\Collection\CategoryCollection\load(), and TYPO3\CMS\Core\Category\Collection\CategoryCollection\loadContents().

◆ setRelationFieldName()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::setRelationFieldName (   $field)

Sets the name of the categories relation field

Parameters
string$field

Definition at line 299 of file CategoryCollection.php.

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

Member Data Documentation

◆ $relationFieldName

string TYPO3\CMS\Core\Category\Collection\CategoryCollection::$relationFieldName = 'categories'
protected

Name of the categories-relation field (used in the MM_match_fields/fieldname property of the TCA)

Definition at line 43 of file CategoryCollection.php.

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

◆ $storageTableName

string TYPO3\CMS\Core\Category\Collection\CategoryCollection::$storageTableName = 'sys_category'
staticprotected

The table name collections are stored to

Definition at line 37 of file CategoryCollection.php.

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