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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DOM without relationships?


Go to End


2 Posts   1100 Views

Avatar
micahsheets

Community Member, 165 Posts

3 April 2010 at 8:43am

Edited: 03/04/2010 8:44am

I was wondering if why DOM needs a relationship between the page it is on and the objects it is managing. I know that most of the time this is the desired behavior. However there are many times I want to use DOM to manage objects that don't need a relationship to any page but I do need a place for the DOM to reside in the CMS.

I have a case where I have a page in the CMS where I edit the Content and a VideoFAQ Object. However the page in the CMS is never seen on the public site nor is it in any menu. I just use that page as a central place to manage the Content and VideoFAQ objects. The objects and Content are shown on three other pages and it is the same for all three pages.

It does work to have a $has_one on the VideoFAQ object for the admin page and a $has_many on the admin page for the VideoFAQ objects but I never use the relationships to do anything because when I want to show a list of the VideoFAQs on any page I just have a function that returns all of them regardless of the page they are related to.

That all being said even though it works to have this relationship it is uncessesary in my case. Is the way I have it set up the way you would do it? I could use ModelAdmin to manage my VideoFAQ objects but I don't like it very much.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 April 2010 at 8:53am

Unfortunately, no, you have to hang the Dataobject somewhere. Often times, I just use my HomePage for lack of a better spot, just to avoid using ModelAdmin.

You raise questions that are really under thorough examination right now. The new version of DOM will allow this, and we're also in the process of giving ModelAdmin a beat-down and a complete makeover to better address workflows like this.