StaticFileCollection extends AbstractFileCollection
A collection containing a static set of files. This collection is persisted to the database with references to all files it contains.
Table of Contents
Properties
- $description : string
- Collection description
- $itemsCriteria : mixed
- Field contents of $itemsCriteriaField. Defines which the items or search criteria for the items depending on the type (see self::$type above) of this file collection.
- $itemsCriteriaField : string
- The name of the field items are handled with (usually either criteria, items or folder)
- $itemTableName : string
- Name of the table records of this collection are stored in
- $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
- $type : string
- The type of file collection (see \TYPO3\CMS\Core\Collection\RecordCollectionRepository::TYPE constants)
- $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 a file to this collection.
- addAll() : mixed
- Adds all files of another collection to the current one.
- count() : int
- Count elements of an object
- create() : CollectionInterface
- Creates a new collection objects and reconstitutes the given database record to the new object.
- current() : T|null
- Return the current element
- fromArray() : mixed
- Similar to method in \TYPO3\CMS\Core\Collection\AbstractRecordCollection, but without $this->itemTableName= $array['table_name'], but with $this->storageItemsFieldContent = $array[self::$storageItemsField];
- getDescription() : string
- Getter for the description
- getIdentifier() : int
- Returns the uid of the collection
- getItems() : array<string|int, mixed>
- Gets the current available items.
- getItemsCriteria() : mixed
- Gets ths items criteria.
- getItemTableName() : string
- Setter for the name of the data-source table
- getTitle() : string
- Getter for the title
- getUid() : int
- Getter for the UID
- key() : string
- Return the key of the current element
- load() : CollectionInterface
- Loads the collections with the given id from persistence
- loadContents() : mixed
- Populates the content-entries of the storage
- next() : void
- Move forward to next element
- persist() : mixed
- Persists current collection state to underlying storage
- remove() : mixed
- Removes a file from this collection.
- removeAll() : mixed
- Removes all elements of the current collection.
- rewind() : void
- Rewind the Iterator to the first element
- setDescription() : mixed
- Sets the description.
- setIdentifier() : mixed
- Sets the identifier of the collection
- setItemsCriteria() : mixed
- Sets the items criteria.
- setItemTableName() : mixed
- Setter for the name of the data-source table
- setTitle() : mixed
- Setter for the title
- toArray() : array<string|int, mixed>
- Similar to method in \TYPO3\CMS\Core\Collection\AbstractRecordCollection, but without 'table_name' => $this->getItemTableName()
- valid() : bool
- Checks if current position is valid
- 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
    
    
    
    
    
    
$itemsCriteria
Field contents of $itemsCriteriaField. Defines which the items or search criteria for the items depending on the type (see self::$type above) of this file collection.
        protected
            mixed
    $itemsCriteria
    
    
    
    
    
    
$itemsCriteriaField
The name of the field items are handled with (usually either criteria, items or folder)
        protected
        static    string
    $itemsCriteriaField
     = 'files'
    
    
    
    
    
$itemTableName
Name of the table records of this collection are stored in
        protected
            string
    $itemTableName
     = 'sys_file_reference'
    
    
    
    
    
$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_file_collection'
    
    
    
    
    
$title
Collection title
        protected
            string
    $title
    
    
    
    
    
    
$type
The type of file collection (see \TYPO3\CMS\Core\Collection\RecordCollectionRepository::TYPE constants)
        protected
        static    string
    $type
     = 'static'
    
    
    
    
    
$uid
Uid of the storage
        protected
            int
    $uid
     = 0
    
    
    
    
    
Methods
__construct()
Creates this object.
    public
                    __construct() : mixed
    __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 a file to this collection.
    public
                    add(FileInterface $data) : mixed
    Parameters
- $data : FileInterface
addAll()
Adds all files of another collection to the current one.
    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 ]) : CollectionInterface
    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
CollectionInterfacecurrent()
Return the current element
    public
                    current() : T|null
    Return values
T|nullfromArray()
Similar to method in \TYPO3\CMS\Core\Collection\AbstractRecordCollection, but without $this->itemTableName= $array['table_name'], but with $this->storageItemsFieldContent = $array[self::$storageItemsField];
    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>getItemsCriteria()
Gets ths items criteria.
    public
                    getItemsCriteria() : mixed
    getItemTableName()
Setter for the name of the data-source table
    public
                    getItemTableName() : 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() : string
    Return values
stringload()
Loads the collections with the given id from persistence
    public
            static        load(int $id[, bool $fillItems = false ]) : CollectionInterface
    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
- $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 
Return values
CollectionInterfaceloadContents()
Populates the content-entries of the storage
    public
                    loadContents() : mixed
    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.
next()
Move forward to next element
    public
                    next() : void
    persist()
Persists current collection state to underlying storage
    public
                    persist() : mixed
    remove()
Removes a file from this collection.
    public
                    remove(File $file) : mixed
    Parameters
- $file : File
removeAll()
Removes all elements of the current collection.
    public
                    removeAll() : mixed
    rewind()
Rewind the Iterator to the first element
    public
                    rewind() : void
    setDescription()
Sets the description.
    public
                    setDescription(string $description) : mixed
    Parameters
- $description : string
setIdentifier()
Sets the identifier of the collection
    public
                    setIdentifier(int $id) : mixed
    Parameters
- $id : int
setItemsCriteria()
Sets the items criteria.
    public
                    setItemsCriteria(mixed $itemsCriteria) : mixed
    Parameters
- $itemsCriteria : mixed
setItemTableName()
Setter for the name of the data-source table
    public
                    setItemTableName(string $tableName) : mixed
    Parameters
- $tableName : string
setTitle()
Setter for the title
    public
                    setTitle(string $title) : mixed
    Parameters
- $title : string
toArray()
Similar to method in \TYPO3\CMS\Core\Collection\AbstractRecordCollection, but without 'table_name' => $this->getItemTableName()
    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.
getCollectionDatabaseTable()
    protected
            static        getCollectionDatabaseTable() : string
    Return values
stringgetItemUidList()
Generates comma-separated list of entry uids for usage in DataHandler
    protected
                    getItemUidList([bool $includeTableName = false ]) : string
    Parameters
- $includeTableName : bool = false
Return values
stringgetPersistableDataArray()
Returns an array of the persistable properties and contents which are processable by DataHandler.
    protected
                    getPersistableDataArray() : array<string|int, mixed>