Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Extending a classes hook with DataObjectDecorator


Go to End


3 Posts   1417 Views

Avatar
baba-papa

Community Member, 279 Posts

11 October 2010 at 9:58pm

Hi,
I want to augment the Member classes functionality wit the DataObjectDecorator by adding new methods and properties. I also want to augment the onAfterWrite() hook with the DataObjectDecorator but i presume that the existing hook of the Member class will be overwritten if I define the hook on the DataObjectDecorator.
How can I add something to a hook via a DataObjectDecorator?

Avatar
(deleted)

Community Member, 473 Posts

11 October 2010 at 10:11pm

That doesn't happen at all :)

You can add methods that don't already exist, but you can't override methods. If a method calls $this->extend(), you can provide a method that'll get called then (the name of the method you can provide is the first argument).

Avatar
baba-papa

Community Member, 279 Posts

11 October 2010 at 10:15pm

Thanks for Your help, simon, I´ll try that.