覆盖doctrine魔术访问器方法

Dzi*_*mid 1 php doctrine symfony1

我尝试覆盖属性getter方法(由sfDoctrineRecord :: __ call()方法处理),如下所示:

//myClass.class.php
public function getProperty()
{
  $property = parent::getProperty();
  //the following line is never reached
  return $property;
}
Run Code Online (Sandbox Code Playgroud)

但这导致无限递归.有可能吗?怎么样?

Jak*_*las 8

试试这样:

public function getProperty()
{
  $property = $this->_get('property');
  //the following line is never reached
  return $property;
}
Run Code Online (Sandbox Code Playgroud)

另外,阅读有关自定义mutators和访问器的信息.