Doctrine_Record::__call PHP Метод

__call() публичный Метод

the function of this method is to try to find a given method from the templates (behaviors) the record is using, and if found, execute it. Note that already existing methods would not be overloaded. So, in sense, this method replicates the usage of mixins (as seen in some programming languages)
public __call ( string $method, array $args ) : mixed
$method string name of the method
$args array method arguments
Результат mixed the return value of the given method
    public function __call($method, $args)
    {
        if (($template = $this->_table->getMethodOwner($method)) !== false) {
            $template->setInvoker($this);
            return call_user_func_array(array($template, $method), $args);
        }
        foreach ($this->_table->getTemplates() as $template) {
            if (is_callable(array($template, $method))) {
                $template->setInvoker($this);
                $this->_table->setMethodOwner($method, $template);
                return call_user_func_array(array($template, $method), $args);
            }
        }
        throw new Doctrine_Record_UnknownPropertyException(sprintf('Unknown method %s::%s', get_class($this), $method));
    }

Usage Example

 /**
  * Extract the value of the field from a record.
  * @param Doctrine_Record $record
  * @return mixed
  */
 public function getValue($record)
 {
     if (!$this->getField()) {
         throw new IllegalStateException('Not field defined por relation ' . $this->getName());
     }
     $getter = 'get' . ucfirst($this->getName());
     return $this->getField()->getValue($record->__call($getter, array()));
 }
All Usage Examples Of Doctrine_Record::__call