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);
}