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.

Data Model Questions /

many-many Members


Reply


2 Posts   739 Views

Avatar
Lindsey J

Community Member, 8 Posts

12 February 2011 at 7:35am

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!

Avatar
Lindsey J

Community Member, 8 Posts

13 February 2011 at 7:59am

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.