lithium\data\Model::applyFilter PHP Method

applyFilter() public static method

Wraps StaticObject::applyFilter() to account for object instances.
See also: lithium\core\StaticObject::applyFilter()
public static applyFilter ( string $method, mixed $closure = null )
$method string
$closure mixed
    public static function applyFilter($method, $closure = null)
    {
        $instance = static::_object();
        if ($method === false) {
            $instance->_instanceFilters = array();
            return;
        }
        $methods = (array) $method;
        foreach ($methods as $method) {
            if (!isset($instance->_instanceFilters[$method]) || $closure === false) {
                $instance->_instanceFilters[$method] = array();
            }
            if ($closure !== false) {
                $instance->_instanceFilters[$method][] = $closure;
            }
        }
    }