CategoryCollection extends AbstractRecordCollection implements EditableCollectionInterface
Category Collection to handle records attached to a category
Table of Contents
Interfaces
- EditableCollectionInterface
- Interface for collection classes which es enabled to be modified
Properties
- $description : string
- Collection description
- $itemTableName : string
- Table name of the records stored in this collection
- $relationFieldName : string
- Name of the categories-relation field (used in the MM_match_fields/fieldname property of the TCA)
- $storage : SplDoublyLinkedList
- The local storage
- $storageItemsField : string
- The table name collections are stored to
- $storageTableName : string
- The table name collections are stored to
- $title : string
- Collection title
- $uid : int
- Uid of the storage
Methods
- __construct() : mixed
- Creates this object.
- __serialize() : array<string|int, mixed>
- Returns class state to be serialized.
- __unserialize() : void
- Load records with the given serialized information
- add() : mixed
- Adds on entry to the collection
- addAll() : mixed
- Adds a set of entries to the collection
- count() : int
- Count elements of an object
- create() : CategoryCollection
- Creates a new collection objects and reconstitutes the given database record to the new object.
- current() : T|null
- Return the current element
- fromArray() : mixed
- Loads the properties of this collection from an array
- getDescription() : string
- Getter for the description
- getIdentifier() : int
- Returns the uid of the collection
- getItems() : array<string|int, mixed>
- Gets the current available items.
- getItemTableName() : string
- Setter for the name of the data-source table
- getRelationFieldName() : string
- Gets the name of the categories relation field
- getStorageItemsField() : string
- Getter for the storage items field
- getStorageTableName() : string
- Getter for the storage table name
- getTitle() : string
- Getter for the title
- getUid() : int
- Getter for the UID
- key() : int|string
- Return the key of the current element
- load() : CategoryCollection
- 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.
- loadContents() : mixed
- Populates the content-entries of the storage Queries the underlying storage for entries of the collection and adds them to the collection data.
- next() : void
- Move forward to next element
- persist() : mixed
- Persists current collection state to underlying storage
- remove() : mixed
- Removes the given entry from collection Note: not the given "index"
- removeAll() : mixed
- Removes all entries from the collection collection will be empty afterwards
- rewind() : void
- Rewind the Iterator to the first element
- setDescription() : mixed
- Setter for the description
- setIdentifier() : mixed
- Sets the identifier of the collection
- setItemTableName() : mixed
- Setter for the name of the data-source table
- setRelationFieldName() : mixed
- Sets the name of the categories relation field
- setTitle() : mixed
- Setter for the title
- toArray() : array<string|int, mixed>
- Builds an array representation of this collection
- valid() : bool
- Checks if current position is valid
- getCollectedRecords() : array<string|int, mixed>
- Gets the collected records in this collection, by using <getCollectedRecordsQueryBuilder>.
- getCollectedRecordsQueryBuilder() : QueryBuilder
- 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'.
- getCollectionDatabaseTable() : string
- getItemUidList() : string
- Generates comma-separated list of entry uids for usage in DataHandler
- getPersistableDataArray() : array<string|int, mixed>
- Returns an array of the persistable properties and contents which are processable by DataHandler.
Properties
$description
Collection description
protected
string
$description
$itemTableName
Table name of the records stored in this collection
protected
string
$itemTableName
$relationFieldName
Name of the categories-relation field (used in the MM_match_fields/fieldname property of the TCA)
protected
string
$relationFieldName
= 'categories'
$storage
The local storage
protected
SplDoublyLinkedList
$storage
$storageItemsField
The table name collections are stored to
protected
static string
$storageItemsField
= 'items'
$storageTableName
The table name collections are stored to
protected
static string
$storageTableName
= 'sys_category'
$title
Collection title
protected
string
$title
$uid
Uid of the storage
protected
int
$uid
= 0
Methods
__construct()
Creates this object.
public
__construct([string $tableName = null ][, string $fieldName = null ]) : mixed
Parameters
- $tableName : string = null
-
Name of the table to be working on
- $fieldName : string = null
-
Name of the field where the categories relations are defined
Tags
__serialize()
Returns class state to be serialized.
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
Load records with the given serialized information
public
__unserialize(array<string|int, mixed> $arrayRepresentation) : void
Parameters
- $arrayRepresentation : array<string|int, mixed>
add()
Adds on entry to the collection
public
add(mixed $data) : mixed
Parameters
- $data : mixed
addAll()
Adds a set of entries to the collection
public
addAll(CollectionInterface $other) : mixed
Parameters
- $other : CollectionInterface
count()
Count elements of an object
public
count() : int
Return values
int —The custom count as an integer.
create()
Creates a new collection objects and reconstitutes the given database record to the new object.
public
static create(array<string|int, mixed> $collectionRecord[, bool $fillItems = false ]) : CategoryCollection
Parameters
- $collectionRecord : array<string|int, mixed>
-
Database record
- $fillItems : bool = false
-
Populates the entries directly on load, might be bad for memory on large collections
Return values
CategoryCollectioncurrent()
Return the current element
public
current() : T|null
Return values
T|nullfromArray()
Loads the properties of this collection from an array
public
fromArray(array<string|int, mixed> $array) : mixed
Parameters
- $array : array<string|int, mixed>
getDescription()
Getter for the description
public
getDescription() : string
Return values
stringgetIdentifier()
Returns the uid of the collection
public
getIdentifier() : int
Return values
intgetItems()
Gets the current available items.
public
getItems() : array<string|int, mixed>
Return values
array<string|int, mixed>getItemTableName()
Setter for the name of the data-source table
public
getItemTableName() : string
Return values
stringgetRelationFieldName()
Gets the name of the categories relation field
public
getRelationFieldName() : string
Return values
stringgetStorageItemsField()
Getter for the storage items field
public
static getStorageItemsField() : string
Return values
stringgetStorageTableName()
Getter for the storage table name
public
static getStorageTableName() : string
Return values
stringgetTitle()
Getter for the title
public
getTitle() : string
Return values
stringgetUid()
Getter for the UID
public
getUid() : int
Return values
intkey()
Return the key of the current element
public
key() : int|string
Return values
int|string —0 on failure.
load()
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.
public
static load(int $id[, bool $fillItems = false ][, string $tableName = '' ][, string $fieldName = '' ]) : CategoryCollection
Entries can be load on first access.
Parameters
- $id : int
-
Id of database record to be loaded
- $fillItems : bool = false
-
Populates the entries directly on load, might be bad for memory on large collections
- $tableName : string = ''
-
Name of table from which entries should be loaded
- $fieldName : string = ''
-
Name of the categories relation field
Return values
CategoryCollectionloadContents()
Populates the content-entries of the storage Queries the underlying storage for entries of the collection and adds them to the collection data.
public
loadContents() : mixed
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.
next()
Move forward to next element
public
next() : void
persist()
Persists current collection state to underlying storage
public
persist() : mixed
remove()
Removes the given entry from collection Note: not the given "index"
public
remove(mixed $data) : mixed
Parameters
- $data : mixed
removeAll()
Removes all entries from the collection collection will be empty afterwards
public
removeAll() : mixed
rewind()
Rewind the Iterator to the first element
public
rewind() : void
setDescription()
Setter for the description
public
setDescription(string $desc) : mixed
Parameters
- $desc : string
setIdentifier()
Sets the identifier of the collection
public
setIdentifier(int $id) : mixed
Parameters
- $id : int
setItemTableName()
Setter for the name of the data-source table
public
setItemTableName(string $tableName) : mixed
Parameters
- $tableName : string
setRelationFieldName()
Sets the name of the categories relation field
public
setRelationFieldName(string $field) : mixed
Parameters
- $field : string
setTitle()
Setter for the title
public
setTitle(string $title) : mixed
Parameters
- $title : string
toArray()
Builds an array representation of this collection
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>valid()
Checks if current position is valid
public
valid() : bool
Return values
bool —The return value will be cast to boolean and then evaluated.
getCollectedRecords()
Gets the collected records in this collection, by using <getCollectedRecordsQueryBuilder>.
protected
getCollectedRecords() : array<string|int, mixed>
Return values
array<string|int, mixed>getCollectedRecordsQueryBuilder()
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'.
protected
getCollectedRecordsQueryBuilder() : QueryBuilder
Return values
QueryBuildergetCollectionDatabaseTable()
protected
static getCollectionDatabaseTable() : string
Return values
stringgetItemUidList()
Generates comma-separated list of entry uids for usage in DataHandler
protected
getItemUidList([bool $includeTableName = true ]) : string
also allow to add table name, if it might be needed by DataHandler for storing the relation
Parameters
- $includeTableName : bool = true
Return values
stringgetPersistableDataArray()
Returns an array of the persistable properties and contents which are processable by DataHandler.
protected
getPersistableDataArray() : array<string|int, mixed>
for internal usage in persist only.