public function __call($method, $args)
{
$delete = false;
if (strncasecmp($method, 'with', 4) === 0) {
$property = $method[4] === '_' ? substr($method, 5) : substr($method, 4);
return $this->getRelationHandler($property, $args);
} else {
if ($findOne = strncasecmp($method, 'findby', 6) === 0) {
$condition = $method[6] === '_' ? substr($method, 7) : substr($method, 6);
} else {
if (strncasecmp($method, 'findallby', 9) === 0) {
$condition = $method[9] === '_' ? substr($method, 10) : substr($method, 9);
} else {
if ($delete = strncasecmp($method, 'deleteby', 8) === 0) {
$condition = $method[8] === '_' ? substr($method, 9) : substr($method, 8);
} else {
if ($delete = strncasecmp($method, 'deleteallby', 11) === 0) {
$condition = $method[11] === '_' ? substr($method, 12) : substr($method, 11);
} else {
if ($this->getInvalidFinderResult() == TActiveRecordInvalidFinderResult::Exception) {
throw new TActiveRecordException('ar_invalid_finder_method', $method);
} else {
return null;
}
}
}
}
}
}
$criteria = $this->getRecordGateway()->getCommand($this)->createCriteriaFromString($method, $condition, $args);
if ($delete) {
return $this->deleteAll($criteria);
} else {
return $findOne ? $this->find($criteria) : $this->findAll($criteria);
}
}