lithium\data\Collection::first()

public method

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

object

Returns the first object found matching the filter criteria.

Source

	public function first($filter = null) {
		return parent::first(is_array($filter) ? $this->_filterFromArray($filter) : $filter);
	}