22975 Posts in 11620 Topics by 2826 members
|Go to End|
6 May 2010 at 4:16am
Why is it preferable to use DataObjectDecorator rather than extending a class? I want to add a 'many_many' to my Member class and it craps out when using DataObjectDecorator, but works fine when I extend the class. What is the difference? Why would I use one or the other?
6 May 2010 at 10:48pm
You would still point to 'Member' in your Many_Many not the extension specifically. A decorator is useful as you can apply multiple decorators per object and you won't have to rewrite core functionality / queries to use your custom class. DataObjectDecorators 'append' functionality to an existing object which can be a cleaner way to extend the functionality.
7 May 2010 at 6:56am
it actually made more sense in my project to go a different direction on this particular problem, but that is good to know. thanks.
|Go to Top|