Collection implements Iterator, Countable
Table of Contents
Interfaces
- Iterator
- Countable
Methods
- __construct() : mixed
- Collection constructor.
- add() : $this
- Add the relation to the collection If a similar relation already present in the collection, the new one will not be added But if the new relation is predefined, it will replace the old one
- count() : int
- current() : Relation|null
- filterByChildEntityTypeId() : Collection
- Returns a new collection filtered by Relation::getChildEntityTypeId === $childEntityTypeId
- filterByEntityTypeId() : Collection
- Returns a new collection filtered by Relation::getParentEntityTypeId === $parentEntityTypeId OR Relation::getChildEntityTypeId === $childEntityTypeId
- filterByParentEntityTypeId() : Collection
- Returns a new collection filtered by Relation::getParentEntityTypeId === $parentEntityTypeId
- filterOutCustomRelations() : Collection
- Returns a new collection where not predefined relations are removed
- filterOutPredefinedRelations() : Collection
- Returns a new collection where predefined relations are removed
- get() : Relation|null
- Returns a relation specified by the identifier If such a relation does not exist in the collection, returns null
- isEmpty() : bool
- Returns true if this collection contains no relations
- key() : int
- merge() : Collection
- Returns a new collection that contains all unique relations from this and the provided collections
- next() : void
- remove() : $this
- Remove a relation from the collection
- rewind() : void
- toArray() : array<string|int, Relation>
- Transform this collection to array
- valid() : bool
Methods
__construct()
Collection constructor.
public
__construct([array<string|int, Relation> $relations = [] ]) : mixed
Parameters
- $relations : array<string|int, Relation> = []
add()
Add the relation to the collection If a similar relation already present in the collection, the new one will not be added But if the new relation is predefined, it will replace the old one
public
add(Relation $relation) : $this
Parameters
- $relation : Relation
Return values
$thiscount()
public
count() : int
Tags
Return values
intcurrent()
public
current() : Relation|null
Tags
Return values
Relation|nullfilterByChildEntityTypeId()
Returns a new collection filtered by Relation::getChildEntityTypeId === $childEntityTypeId
public
filterByChildEntityTypeId(int $childEntityTypeId) : Collection
Relation objects are NOT cloned
Parameters
- $childEntityTypeId : int
Return values
CollectionfilterByEntityTypeId()
Returns a new collection filtered by Relation::getParentEntityTypeId === $parentEntityTypeId OR Relation::getChildEntityTypeId === $childEntityTypeId
public
filterByEntityTypeId(int $entityTypeId) : Collection
Relation objects are NOT cloned
Parameters
- $entityTypeId : int
Return values
CollectionfilterByParentEntityTypeId()
Returns a new collection filtered by Relation::getParentEntityTypeId === $parentEntityTypeId
public
filterByParentEntityTypeId(int $parentEntityTypeId) : Collection
Relation objects are NOT cloned
Parameters
- $parentEntityTypeId : int
Return values
CollectionfilterOutCustomRelations()
Returns a new collection where not predefined relations are removed
public
filterOutCustomRelations() : Collection
Relation objects are NOT cloned
Return values
CollectionfilterOutPredefinedRelations()
Returns a new collection where predefined relations are removed
public
filterOutPredefinedRelations() : Collection
Relation objects are NOT cloned
Return values
Collectionget()
Returns a relation specified by the identifier If such a relation does not exist in the collection, returns null
public
get(RelationIdentifier $identifier) : Relation|null
Parameters
- $identifier : RelationIdentifier
Return values
Relation|nullisEmpty()
Returns true if this collection contains no relations
public
isEmpty() : bool
Return values
boolkey()
public
key() : int
Tags
Return values
intmerge()
Returns a new collection that contains all unique relations from this and the provided collections
public
merge(Collection $collection) : Collection
Parameters
- $collection : Collection
Return values
Collectionnext()
public
next() : void
Tags
remove()
Remove a relation from the collection
public
remove(RelationIdentifier $identifier) : $this
Parameters
- $identifier : RelationIdentifier
Return values
$thisrewind()
public
rewind() : void
Tags
toArray()
Transform this collection to array
public
toArray() : array<string|int, Relation>
Return values
array<string|int, Relation>valid()
public
valid() : bool