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

DataObjectDecorator not extending all functions?


Reply

714 Views

Avatar
MarijnKampf

3 December 2010 at 10:40pm Community Member, 164 Posts

I've writing some code that adds a Related Pages tab to the CMS and allows you to select related pages. As my code originally was added to the Page class I thought I would change it to a generic module. I however ran into a problem, which my be a bug.

First I had to change the Page_Related.RelatedID column in the database to Page_Related.ChildID (This could be a DataObjectManager issue rather than the CMS - and [url=http://doc.silverstripe.org/dataobjectdecorator#custom_database_generation]potentially easily solved[/url]).

After correcting this I'm getting the error:
<b>Fatal error</b>: Call to undefined method Related::extendedSQL() in <b>G:\localhost\largeherbivore.org\sapphire\core\model\DataObject.php</b> on line <b>1429</b><br />

I thought that
class Related extends DataObjectDecorator
+
Object::add_extension('Page', 'Related');
should have taken care of the object inheritance?

Why isn't the DataObjectDecorator missing the functions that work for the Page extened version? I've included the codes for both the module version and the non module version of the code.

Attached Files