lithium\data\Collection::_filterFromArray()

protected method

Creates a filter based on an array of key/value pairs that must match the items in a Collection.

Parameters

  • array $filter

    An array of key/value pairs used to filter Collection items.

Returns

\Closure

Returns a closure that wraps the array and attempts to match each value against Collection item properties.

Source

	protected function _filterFromArray(array $filter) {
		return function($item) use ($filter) {
			foreach ($filter as $key => $val) {
				if ($item->{$key} != $val) {
					return false;
				}
			}
			return true;
		};
	}