RelationshipData
class RelationshipData extends Data (View source)
| internal | JSON:API maintains no PHP API. The API is the HTTP API. This class may change at any time and could break any dependencies on it. |
Represents the data of a relationship object or relationship document.
Properties
| protected ResourceIdentifierInterface[] | $data | Various representations of JSON:API objects. |
from Data |
| protected int | $cardinality | The number of resources permitted in this collection. |
from Data |
| protected bool | $hasNextPage | Holds a boolean indicating if there is a next page. |
from Data |
| protected int | $count | Holds the total count of entities. |
from Data |
Methods
RelationshipData constructor.
Details
__construct(array $data, int $cardinality = -1)
RelationshipData constructor.
in
Data at line 72
ArrayIterator
getIterator()
Returns an iterator for entities.
in
Data at line 83
int
count()
Returns the number of entities.
in
Data at line 91
getTotalCount()
{@inheritdoc}
in
Data at line 98
setTotalCount($count)
{@inheritdoc}
in
Data at line 108
EntityInterface[]
toArray()
Returns the collection as an array.
in
Data at line 118
bool
hasNextPage()
Checks if there is a next page in the collection.
in
Data at line 131
setHasNextPage(bool $has_next_page)
Sets the has next page flag.
Once the collection query has been executed and we build the entity collection, we now if there will be a next page with extra entities.
in
Data at line 141
int
getCardinality()
Gets the cardinality of this collection.
in
Data at line 156
static Data
merge(Data $a, Data $b)
Returns a new Data object containing the entities of $this and $other.
in
Data at line 169
static Data
deduplicate(Data $collection)
Returns a new, deduplicated Data object.