‪TYPO3CMS  10.4
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\PersistableCollectionInterface TYPO3\CMS\Core\Collection\SortableCollectionInterface 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 ()
 
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)
 

Static Public Member Functions

static CategoryCollection create (array $collectionRecord, $fillItems=false)
 
static CollectionInterface load ($id, $fillItems=false, $tableName='', $fieldName='')
 
static string getStorageTableName ()
 
static string getStorageItemsField ()
 
- ‪Static Public Member Functions inherited from ‪TYPO3\CMS\Core\Collection\AbstractRecordCollection
static TYPO3 CMS Core Collection 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 $storageTableName = 'sys_collection'
 
static string $storageItemsField = 'items'
 

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 29 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 50 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

Parameters
CollectionInterface$other

Implements TYPO3\CMS\Core\Collection\EditableCollectionInterface.

Definition at line 249 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 71 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 187 of file CategoryCollection.php.

References 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

◆ getItems()

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

Gets the current available items.

Returns
‪array

Definition at line 288 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 225 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 313 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 CollectionInterface 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
‪CollectionInterface

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

Definition at line 98 of file CategoryCollection.php.

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

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 209 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 262 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 278 of file CategoryCollection.php.

Referenced by 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 303 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 41 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 35 of file CategoryCollection.php.

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