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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Decorating doesn't work (in any case)


Go to End


3 Posts   906 Views

Avatar
esakrielaart

Community Member, 59 Posts

13 March 2012 at 4:20am

Edited: 13/03/2012 4:21am

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

Forum Moderator, 1899 Posts

13 March 2012 at 4:51am

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

Community Member, 59 Posts

16 March 2012 at 4:31am

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