$objects
$objects : array<mixed,object>
The objects contained in the collection.
Stored as a dictionary indexed by each object's primary key. Ensures that each object gets loaded only once by keeping every loaded object in an associative array.
A Model Collection
For iterating instances of \Charcoal\Model\ModelInterface.
Used by \Charcoal\Loader\CollectionLoader for storing results.
The collection stores models by their primary key. If two objects share the same storable ID but hold disparate data, they are considered to be alike. Adding an object that shares the same ID as an object previously stored in the collection will replace the latter.
objects() : array<mixed,object>
Alias of {@see self::values()}
todo |
Trigger deprecation error. |
---|
todo |
Trigger deprecation error. |
---|
isAcceptable(mixed $value) : boolean
Determine if the given value is acceptable for the collection.
Note: Practical for specialized collections extending the base collection.
mixed | $value | The value being vetted. |
None found |
None found |
toBase() : \Charcoal\Model\Collection
Get a base collection instance from this collection.
Note: Practical for extended classes.
None found |
resolveOffset(integer $offset) : integer
Parse the array offset.
If offset is non-negative, the sequence will start at that offset in the collection. If offset is negative, the sequence will start that far from the end of the collection.
integer | $offset | The array offset. |
Returns the resolved array offset.
None found |
modelKey(object $obj) : boolean
Convert a given object into a model identifier.
Note: Practical for specialized collections extending the base collection.
object | $obj | An acceptable object. |
If the given object is not acceptable.
None found |