public function __call($method, $args)
{
$delete = false;
if ($findOne = substr(strtolower($method), 0, 6) === 'findby') {
$condition = $method[6] === '_' ? substr($method, 7) : substr($method, 6);
} else {
if (substr(strtolower($method), 0, 9) === 'findallby') {
$condition = $method[9] === '_' ? substr($method, 10) : substr($method, 9);
} else {
if ($delete = substr(strtolower($method), 0, 8) === 'deleteby') {
$condition = $method[8] === '_' ? substr($method, 9) : substr($method, 8);
} else {
if ($delete = substr(strtolower($method), 0, 11) === 'deleteallby') {
$condition = $method[11] === '_' ? substr($method, 12) : substr($method, 11);
} else {
return null;
}
}
}
}
$criteria = $this->getCommand()->createCriteriaFromString($method, $condition, $args);
if ($delete) {
return $this->deleteAll($criteria);
} else {
return $findOne ? $this->find($criteria) : $this->findAll($criteria);
}
}