lithium\data\Collection::first()
Overrides
lithium\util\Collection::first()
Overrides parent first()
implementation to enable key/value-based filtering.
Parameters
-
mixed
$filter
In addition to a callback (see parent), can also be an array where the keys and values must match the property values of the objects being inspected.
Returns
objectReturns the first object found matching the filter criteria.
Source
public function first($filter = null) {
return parent::first(is_array($filter) ? $this->_filterFromArray($filter) : $filter);
}