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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

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

[SOLVED] $many_many relationships

Go to End



Community Member, 545 Posts

10 September 2009 at 2:51am

Edited: 11/09/2009 5:16pm

Here's the situation I have a Product page type and Top10Page page type. The Top10Page type is supposed to hold a list of Top 10 Products, I assume for that I need a $many_many relationship.

In my Top10Page I have the following:

static $many_many = array ('Products'=>'Product');

which should establish the relationship with the Product Pages

In the Product I have

static $belongs_many_many = array('Top10Pages' => 'Top10Page');

which should establish the relationship back with the Top10Pages.

However when I dev/build it doesn't complete the process. The relationship works if its just Top10Page $has_many Product but I will have more than 1 Top10Page in system at a time. Am I missing a step?

I really don't think I understand how the $many_many relation works

EDIT Tracked down the problem to the Multi Selector Field Module