lithium\data\Model::hasFinder()
Checks whether given name can be used as a finder in Model::find()
.
Parameters
-
string
$name
Name of the method, i.e.
'first'
or'byId'
.
Returns
booleanSource
public static function hasFinder($name) {
if ($name === 'all') {
return true;
}
if (isset(static::object()->_finders[$name])) {
return true;
}
preg_match(
'/^(find)?[Bb]y(?P<field>\w+)$|^(find)?(?P<type>\w+)[Bb]y(?P<fields>\w+)$/',
$name,
$args
);
return (boolean) $args;
}