Neos\Flow\Persistence\Repository::__call PHP Метод

__call() публичный Метод

Provides three methods - findBy($value, $caseSensitive = TRUE, $cacheResult = FALSE) - findOneBy($value, $caseSensitive = TRUE, $cacheResult = FALSE) - countBy($value, $caseSensitive = TRUE)
public __call ( string $method, array $arguments ) : mixed
$method string Name of the method
$arguments array The arguments
Результат mixed The result of the repository method
    public function __call($method, $arguments)
    {
        $query = $this->createQuery();
        $caseSensitive = isset($arguments[1]) ? (bool) $arguments[1] : true;
        $cacheResult = isset($arguments[2]) ? (bool) $arguments[2] : false;
        if (isset($method[10]) && strpos($method, 'findOneBy') === 0) {
            $propertyName = lcfirst(substr($method, 9));
            return $query->matching($query->equals($propertyName, $arguments[0], $caseSensitive))->execute($cacheResult)->getFirst();
        } elseif (isset($method[8]) && strpos($method, 'countBy') === 0) {
            $propertyName = lcfirst(substr($method, 7));
            return $query->matching($query->equals($propertyName, $arguments[0], $caseSensitive))->count();
        } elseif (isset($method[7]) && strpos($method, 'findBy') === 0) {
            $propertyName = lcfirst(substr($method, 6));
            return $query->matching($query->equals($propertyName, $arguments[0], $caseSensitive))->execute($cacheResult);
        }
        trigger_error('Call to undefined method ' . get_class($this) . '::' . $method, E_USER_ERROR);
    }