public function __call($method, $args)
{
$prefix = substr($method, 0, 3);
if ($method == 'findPk') {
return $this->_findPk($args);
} else {
if ($method == 'find') {
return call_user_func_array(array($this, '_find'), $args);
} else {
if ($method == 'findOne') {
return call_user_func_array(array($this, '_findOne'), $args);
} else {
if ($method == 'all') {
return $this->_find();
} else {
if ($method == 'deleteBy') {
return call_user_func_array(array($this, '_delete'), $args);
} else {
if ($method == 'deletePk') {
return $this->_deletePk($args);
} else {
if (strpos($method, 'deleteBy') === 0) {
$field = lcfirst(substr($method, 8));
return empty($field) ? call_user_func_array([$this, '_delete'], $args) : $this->_delete([["{$field}" => isset($args[0]) ? $args[0] : null]]);
} else {
if (strpos($method, 'deleteOneBy') === 0) {
$field = lcfirst(substr($method, 8));
return empty($field) ? call_user_func_array([$this, '_delete'], array_merge($args, [1])) : $this->_delete([["{$field}" => isset($args[0]) ? $args[0] : null]], 1);
} else {
if ($method == 'prepareSaveStatement') {
return $this->_prepareSaveStatement();
} else {
if ($method == 'hasUniqueIndex') {
return $this->_hasUniqueIndex();
} else {
if ($prefix == 'get') {
$prop = lcfirst(substr($method, 3));
if (property_exists($this, $prop)) {
return $this->{$prop};
}
} else {
if ($prefix == 'set') {
$prop = lcfirst(substr($method, 3));
if (property_exists($this, $prop)) {
$this->{$prop} = isset($args[0]) ? $args[0] : null;
return $this;
}
} else {
if (strpos($method, 'findBy') === 0) {
$field = lcfirst(substr($method, 6));
return empty($field) ? call_user_func_array(array($this, '_find'), $args) : $this->_find([["{$field}" => isset($args[0]) ? $args[0] : null]]);
} else {
if (strpos($method, 'findOneBy') === 0) {
$field = lcfirst(substr($method, 9));
return empty($field) ? call_user_func_array(array($this, '_findOne'), $args) : $this->_findOne([["{$field}" => isset($args[0]) ? $args[0] : null]]);
} else {
if (strpos($method, 'column') === 0) {
$field = lcfirst(substr($method, 6));
if (!empty($field)) {
array_unshift($args, $field);
}
return call_user_func_array([$this, '_column'], $args);
} else {
throw new BadMethodCallException(sprintf('Could not find method "%s" for the class "%s".', $method, get_class($this)));
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
throw new BadMethodCallException(sprintf('Property "%s" does not exist for the class "%s".', $prop, get_class($this)));
}