public function callFinder($type, Query $query, array $options = [])
{
$query->applyOptions($options);
$options = $query->getOptions();
$finder = 'find' . $type;
if (method_exists($this, $finder)) {
return $this->{$finder}($query, $options);
}
if ($this->_behaviors && $this->_behaviors->hasFinder($type)) {
return $this->_behaviors->callFinder($type, [$query, $options]);
}
throw new BadMethodCallException(sprintf('Unknown finder method "%s"', $type));
}