Documentation

3.2 Integrated relations in code

Integrated Relations can be used in code. Every variety of content supports these functions. Below, various Integrated Relations are listed.

Returning a collection containing the embedded Relation documents:

1
$content->getRelations();

Returning one embedded Relation document based on the relationId of the embedded Relation document:

1
$content->getRelation($relationId);

Returning a collection containing the embedded Relation document based on the relationType:

1
$content->getRelationsByRelationType($relationType);

Returning a collection containing all the references based on the embedded Relation documents that match $relationType:

1
$content->getReferencesByRelationType($relationType);

Returning a collection containing all the references based on the embedded Relation documents that match the relation with $relationId (use this function with care, because an admin user may delete the relation):

1
$content->getReferencesByRelationId($relationId);

Returning the first reference based on the embedded Relation documents that match the relation with $relationId (use this function with care, because an admin user may delete the relation):

1
$content->getFirstReferenceByRelationId($relationId);