本文整理汇总了PHP中sfDoctrineRecord::__call方法的典型用法代码示例。如果您正苦于以下问题:PHP sfDoctrineRecord::__call方法的具体用法?PHP sfDoctrineRecord::__call怎么用?PHP sfDoctrineRecord::__call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfDoctrineRecord
的用法示例。
在下文中一共展示了sfDoctrineRecord::__call方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
/**
* Provides getter and setter methods.
*
* @param string $method The method name
* @param array $arguments The method arguments
*
* @return mixed The returned value of the called method
*/
public function __call($method, $arguments)
{
$failed = false;
try {
return parent::__call($method, $arguments);
} catch (Exception $e) {
$failed = true;
}
if ($failed) {
try {
if (in_array($verb = substr($method, 0, 3), array('set', 'get'))) {
$name = substr($method, 3);
/* @var $table Doctrine_Table */
$table = $this->getTable();
foreach ($table->getRelations() as $alias => $relation) {
if ($name == str_replace('_', '', $alias)) {
$entityName = $alias;
}
}
return call_user_func_array(array($this, $verb), array_merge(array($entityName), $arguments));
}
} catch (Exception $e) {
$failed = true;
}
if ($failed) {
throw new Doctrine_Record_UnknownPropertyException(sprintf('Unknown method %s::%s', get_class($this), $method));
}
}
}
示例2: __call
/**
* Provides access to i18n methods
*
* @param string $method The method name
* @param array $arguments The method arguments
*
* @return mixed The returned value of the called method
*/
public function __call($method, $arguments)
{
try {
return parent::__call($method, $arguments);
} catch (Exception $parentException) {
try {
if ($this->getTable()->hasI18n() && ($i18n = $this->getCurrentTranslation())) {
return call_user_func_array(array($i18n, $method), $arguments);
}
} catch (Exception $e) {
}
throw $parentException;
}
}