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.

Data Model Questions /

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

Extending DataObject


Go to End


4 Posts   1978 Views

Avatar
imihai

Community Member, 2 Posts

12 August 2009 at 6:32pm

Edited: 12/08/2009 6:32pm

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

Community Member, 29 Posts

12 August 2009 at 8:15pm

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

Community Member, 2 Posts

12 August 2009 at 8:23pm

No luck there :( ,

Avatar
Hamish

Community Member, 712 Posts

13 August 2009 at 9:58am

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 Creating Modules in the wiki.