function RelationQuery::related in Relation 7
Add a related entity to the query.
Parameters
$entity_type: Entity type of the related entity.
$entity_id: Entity id of the related entity. Can be an array of entity IDs.
$r_index: The index of the related entity within the requested relation(s).
Return value
1 call to RelationQuery::related()
- RelationQuery::__construct in ./
relation.database.inc - Constructor for RelationQuery.
File
- ./
relation.database.inc, line 40 - Database query functions.
Class
- RelationQuery
- Handler class for entity relations.
Code
function related($entity_type, $entity_id, $r_index = NULL) {
$this
->fieldCondition('endpoints', 'entity_type', $entity_type, '=', $this->delta_group);
$this
->fieldCondition('endpoints', 'entity_id', $entity_id, NULL, $this->delta_group);
if (isset($r_index)) {
$this
->fieldCondition('endpoints', 'r_index', $r_index, '=', $this->delta_group);
}
$this->delta_group++;
return $this;
}