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.

General Questions

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

Decorating doesn't work (in any case)


Reply

3 Posts   500 Views

Avatar
esakrielaart

13 March 2012 at 4:20am (Last edited: 13 March 2012 4:21am), Community Member, 56 Posts

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

Avatar
swaiba

13 March 2012 at 4:51am Forum Moderator, 1796 Posts

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.

Avatar
esakrielaart

16 March 2012 at 4:31am Community Member, 56 Posts

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