Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » [SOLVED] $many_many relationships

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

Page: 1
Go to End
Author Topic: 912 Views
  • zenmonkey
    Community Member
    528 Posts

    [SOLVED] $many_many relationships Link to this post

    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

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.