fixed fatal method delegation bug
This commit is contained in:
parent
d78f992eb6
commit
7391081d81
@ -1597,16 +1597,14 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
static $methods = array();
|
||||
if ( isset( $methods[$method])) {
|
||||
$template = $methods[$method];
|
||||
if (($template = $this->_table->getMethodOwner($method)) !== false) {
|
||||
$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) {
|
||||
if (method_exists($template, $method)) {
|
||||
$template->setInvoker($this);
|
||||
$methods[$method] = $template;
|
||||
$this->_table->setMethodOwner($method, $template);
|
||||
|
||||
return call_user_func_array(array($template, $method), $args);
|
||||
}
|
||||
|
@ -162,6 +162,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
* @var array $_filters an array containing all record filters attached to this table
|
||||
*/
|
||||
protected $_filters = array();
|
||||
|
||||
protected $_invokedMethods = array();
|
||||
|
||||
|
||||
|
||||
@ -295,6 +297,16 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$this->_filters[] = new Doctrine_Record_Filter_Standard();
|
||||
$this->_repository = new Doctrine_Table_Repository($this);
|
||||
}
|
||||
public function getMethodOwner($method)
|
||||
{
|
||||
return (isset($this->_invokedMethods[$method])) ?
|
||||
$this->_invokedMethods[$method] : false;
|
||||
}
|
||||
|
||||
public function setMethodOwner($method, $class)
|
||||
{
|
||||
$this->_invokedMethods[$method] = $class;
|
||||
}
|
||||
/**
|
||||
* getTemplates
|
||||
* returns all templates attached to this table
|
||||
|
Loading…
x
Reference in New Issue
Block a user