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.

Data Model Questions

Extending DataObject


Reply

4 Posts   1173 Views

Avatar
imihai

12 August 2009 at 6:32pm (Last edited: 12 August 2009 6:32pm), Community Member, 2 Posts

Hi guys, just wanting to congratulate you on the great job so far, and I only have just one question related to DataObject extensions :
I am currently developing a module which requires quite a lot of tables (15 or more) and I thought that Extending DataObject would be the best way to do it so I went on and defined my classes in the modules _config.php, now, is that the best way to do it because this Undefined index error in sapphire/core/ClassInfo.php (ancestry) keep popping up when least expected and I`m really out of ideas. Any help would be greatly appreciated.

Avatar
chrclaus

12 August 2009 at 8:15pm Community Member, 29 Posts

Hi imihai,

You have to register your extensions and the best place is - from my current point of view - in the _config.php.

I gained the experiences, that creating the extension classes and insert the extension-registration in the _config.php in one step does not work. I found a solution with commenting the registration entries in _config.php and run a db/build?flush=1, uncommenting and run a db/build again. I did not find any reason for the steps, but it works.

Best regards,
chrclaus

Avatar
imihai

12 August 2009 at 8:23pm Community Member, 2 Posts

No luck there :( ,

Avatar
Hamish

13 August 2009 at 9:58am Community Member, 712 Posts

No, _config.php is for module configuration and acts as a flag to tell SilverStripe that a module extists at this location.

Put your class files in the 'code' subdirectory under _config.php.

See [url=http://doc.silverstripe.org/doku.php?id=creating-modules]Creating Modules[/url] in the wiki.