Jump to:

23372 Posts in 18175 Topics by 2865 members

General Questions

SilverStripe Forums » General Questions » Decorating doesn't work (in any case)

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 467 Views
  • esakrielaart
    Avatar
    Community Member
    54 Posts

    Decorating doesn't work (in any case) Link to this post

    Hi,

    I am trying to get the decorating thing for Memberclass working. Unfortunately, how hard I try (following literally the examples on the silverstripe website), it isn't working, I get an error when running de/build/:

    Fatal error: Object::add_extension() - Extension "CommissionDescription" is not a subclass of Extension in C:\[path]\sapphire\core\Object.php on line 530

    Currently I am using silverstripe 2.4.5.

    I use for CommissionDescription:

    class CommissionDescription extends DataObjectDecorator {
    // some thing like extraStatics in here
    }

    and in the mysite/_config.php file:

    Object::add_extension('Member', 'CommissionDescription');

    Does this give some of you any clue on what might be going on?

    Thanks in advance,
    Maurice

  • swaiba
    Avatar
    Forum Moderator
    1785 Posts

    Re: Decorating doesn't work (in any case) Link to this post

    Hi,

    You have the right syntax, however what can happen is that if the object hasn't been built yet then the stuff in the _config.php will fail.

    So comment the stuff in the _config.php, dev/build, then un comment and dev/build again. Hopefully that will fix it.

  • esakrielaart
    Avatar
    Community Member
    54 Posts

    Re: Decorating doesn't work (in any case) Link to this post

    Jep, that just fixed it for me, thanks! Now I can finally use the decoration functions!

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