function relation_query in Relation 8
Same name and namespace in other branches
- 8.2 relation.module \relation_query()
- 7 relation.module \relation_query()
Returns a query object to find related entities.
@todo deprecate this
Parameters
string|null $entity_type: (optional) The entity type of one of the endpoints.
int|null $entity_id: (optional) The entity id of one of the endpoints. Can also be an array of entity IDs.
int|null $r_index: (optional) The index of the search entity in the relation to be found (0 = source, 1 = target).
Return value
RelationQuery The query object itself.
1 call to relation_query()
- RelationAPITest::testRelationQuery in src/
Tests/ RelationAPITest.php - Tests all available methods in RelationQuery.
File
- ./
relation.module, line 137 - Describes relations between entities.
Code
function relation_query($entity_type = NULL, $entity_id = NULL, $r_index = NULL) {
$query = Drupal::entityQuery('relation');
if ($entity_type) {
relation_query_add_related($query, $entity_type, $entity_id, $r_index);
}
return $query;
}