Added support for Propel style getters/setters to __call()
This commit is contained in:
parent
029761d78d
commit
8598411b02
1 changed files with 11 additions and 0 deletions
|
@ -1558,10 +1558,21 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||||
*/
|
*/
|
||||||
public function __call($method, $args)
|
public function __call($method, $args)
|
||||||
{
|
{
|
||||||
|
// To support propel style getters/setters
|
||||||
|
$verb = substr($method, 0, 3);
|
||||||
|
$field = Doctrine::tableize(substr($method, 3, strlen($method)));
|
||||||
|
|
||||||
|
if ($verb === 'get') {
|
||||||
|
return $this->$verb($field);
|
||||||
|
} else if ($verb === 'set') {
|
||||||
|
return $this->$verb($field, $args[0]);
|
||||||
|
}
|
||||||
|
|
||||||
if (($template = $this->_table->getMethodOwner($method)) !== false) {
|
if (($template = $this->_table->getMethodOwner($method)) !== false) {
|
||||||
$template->setInvoker($this);
|
$template->setInvoker($this);
|
||||||
return call_user_func_array(array($template, $method), $args);
|
return call_user_func_array(array($template, $method), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->_table->getTemplates() as $template) {
|
foreach ($this->_table->getTemplates() as $template) {
|
||||||
if (method_exists($template, $method)) {
|
if (method_exists($template, $method)) {
|
||||||
$template->setInvoker($this);
|
$template->setInvoker($this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue