I have a model class (obviously, it extends Doctrine_Record) that “acts as” a custom template.
I want to get values like this: “echo $record->virtual_field”. Is there a way to override the getter method in my custom template to provide a custom response, then either pass on the request to the parent class or not?
In other words, is there a way to override Doctrine_Record::__get() from a related template?
Ok. I assume you’re not talking about actual Behaviour ‘actAs’ Templates.
If you define a new __get() method, it will automatically override the parent’s __get() method.
Now in your new __get() method, you first check if it exists in your current instance, and then the parent’s.
I hacked this together (bear in mind, it’s almost midnight):
Now I dont know how well this works for what you are trying to achieve.