Jump to:

3429 Posts in 1057 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Extending a classes hook with DataObjectDecorator

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

Page: 1
Go to End
Author Topic: 1103 Views
  • baba-papa
    Avatar
    Community Member
    279 Posts

    Extending a classes hook with DataObjectDecorator Link to this post

    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?

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: Extending a classes hook with DataObjectDecorator Link to this post

    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).

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: Extending a classes hook with DataObjectDecorator Link to this post

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

    1103 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.