I try to override a property getter method (which is processed by sfDoctrineRecord::__call() method) like this:
//myClass.class.php
public function getProperty()
{
$property = parent::getProperty();
//the following line is never reached
return $property;
}
But this results in infinite recursion. Is it possible and how?
Try like this:
public function getProperty()
{
$property = $this->_get('property');
//the following line is never reached
return $property;
}
Also, read about custom mutators and accessors.
Within the DoctrineRecord.__call method you'll see it uses call_user_func_array
, which will try to call the getProperty
method of the class.
Since you've overriden getProperty
, it's calling the child class definition, so it's calling itself.