PersistableCollectionInterface

Interface for collection class being persistable

Collections are containers-classes handling the storage of data values (f.e. strings, records, relations) in a common and generic way, while the class manages the storage in an appropriate way itself

Table of Contents

Methods

getIdentifier()  : int|string
Get the identifier of the collection
load()  : CollectionInterface
Loads the collections with the given id from persistence
loadContents()  : mixed
Populates the content-entries of the storage
persist()  : mixed
Persists current collection state to underlying storage
setIdentifier()  : mixed
Sets the identifier of the collection

Methods

getIdentifier()

Get the identifier of the collection

public getIdentifier() : int|string

For database stored collections, this will be an integer, session stored, registry stored or other collections might use a string as well

Return values
int|string

load()

Loads the collections with the given id from persistence

public static load(int|string $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|string
$fillItems : bool = false

Populates the entries directly on load, might be bad for memory on large collections

Return values
CollectionInterface

loadContents()

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.

persist()

Persists current collection state to underlying storage

public persist() : mixed

setIdentifier()

Sets the identifier of the collection

public setIdentifier(int|string $id) : mixed
Parameters
$id : int|string

        
On this page

Search results