lithium\data\model\Relationship::_find()
Gets all entities attached to a collection en entities.
Parameters
-
mixed
$id An id or an array of ids.
Returns
objectA collection of items matching the id/ids.
Source
protected function _find($id, $options = []) {
if ($this->link() !== static::LINK_KEY && $this->link() !== static::LINK_KEY_LIST) {
throw new Exception("This relation is not based on a foreign key.");
}
if ($id === []) {
return [];
}
$to = $this->to();
$options += ['conditions' => []];
$options['conditions'] = array_merge($options['conditions'], [
current($this->key()) => $id
]);
return $to::find('all', $options);
}