This interface represents an iterable collection of Model elements.

 Methods

Alias for push - Append a model to the end of this collection.

add(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel) : void
deprecated Use push.

Parameters

$objModel

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The model to append to the collection.

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException When no model has been passed.

Check whether the given model is contained in the collection.

contains(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $model) : bool

Parameters

Returns

bool

Check whether the given model is contained in the collection.

containsById(mixed $modelId) : bool

Parameters

$modelId

mixed

The model id to search.

Returns

bool

Computes the difference of the collection.

diff(\ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface $collection) : \ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

Parameters

$collection

\ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

The collection to compute the difference for.

Returns

\ContaoCommunityAlliance\DcGeneral\Data\CollectionInterfaceThe collection containing all the entries from this collection that are not present in the given collection.

Get the model at a specific index.

get(int $intIndex) : \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

Parameters

$intIndex

int

The index of the model to retrieve.

Returns

Retrieve the ids of the models.

getModelIds() : array

Returns

array

Insert a record at the specific position.

insert(int $intIndex, \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel) : void
Move all records at position >= $index one index up. If $index is out of bounds, just add at the end (does not fill with empty records!).

Parameters

$intIndex

int

The index where the model shall be placed.

Intersect the given collection with this collection and return the result.

intersect(\ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface $collection) : \ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

Check if the given collection is an subset of the given collection.

isSubsetOf(\ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface $collection) : boolean

Parameters

Returns

boolean

Get length of this collection.

length() : int

Returns

int

Remove the model at the end of the collection and return it.

pop() : \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface
If the collection is empty, null will be returned.

Returns

Append a model to the end of this collection.

push(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel) : void

Parameters

$objModel

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The model to append to the collection.

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException When no model has been passed.

Remove the given index or model from the collection and renew the index.

remove(mixed $mixedValue) : void
ATTENTION: Don't use key to unset in foreach because of the new index.

Parameters

$mixedValue

mixed

The index (integer) or InterfaceGeneralModel instance to remove.

Remove the model with the given id from the collection.

removeById(mixed $modelId) : void

Parameters

$modelId

mixed

The id of the model to remove.

Make a reverse sorted collection of this collection.

reverse() : \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

Remove the model from the beginning of the collection and return it.

shift() : \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface
If the collection is empty, null will be returned.

Returns

Sort the records with the given callback and return the new sorted collection.

sort(callback $callback) : \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

Parameters

$callback

callback

The callback function to use.

Returns

Compute the union of this collection and the given collection.

union(\ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface $collection) : \ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

Insert a model at the beginning of the collection.

unshift(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel) : void

Parameters

$objModel

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The model to insert into the collection.