Jump to:

3431 Posts in 1058 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » many-many Members

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

Page: 1
Go to End
Author Topic: 663 Views
  • Lindsey J
    Avatar
    Community Member
    8 Posts

    many-many Members Link to this post

    Hello! I'm very new to SilverStripe and loving it so far.

    I have 2 types of user classes that extend Members (Students and Teachers), and they have a many-to-many relationship. Ultimately, I'd like those types to be tied to Groups (which I've already created in Security).

    I've created the classes and their relationship, which resulted in a shiny new join table in the DB.

    The examples in the tutorial and the book always seem to show the many-many relationship between a Page and a DataObject though.
    I need to make an interface to assign specific Students to specific Teachers in the back end.

    In the front end, Teachers will need to be able to select one of their students and view some of their data on a page.
    Students should be able to get select info about their Teachers as well.

    I think I need to use getCMSFields(), getCMSFields_forPopup(), and ComplexTableField like in the examples, but those seem to interact with Pages rather than DataObjects (or Members).

    Is this possible with my Student and Teacher Members? Help is greatly appreciated!

  • Lindsey J
    Avatar
    Community Member
    8 Posts

    Re: many-many Members Link to this post

    Update - modeladmin is amazing, and a much better way to go, at least in this case!
    New question: many_many doesn't seem to work out of the box with modeladmin. Is this being worked on? 'Til then, I'm going to change my app's behavior to use a has_many and a has_one.

    663 Views
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.