3460 Posts in 1064 Topics by 739 members
|Go to End|
22 July 2010 at 9:55pm Last edited: 22 July 2010 9:57pm
I'm in the process of converting what had been a normal silverstripe project into one using the ModelAdmin simply because the client's requirements went through the roof and the ModelAdmin looks like the best way to achieve what I need to achieve. However I've hit a brick wall and need some help.
Trying to explain what I want to achieve is a wee bit tricky but here goes,
Organisations has many contacts (done), they have one category and one legal status (both done), they have many target groups - and this is where I'm stuck.
I have created a TargetGroup bit in the ModelAdmin and populated with all the target groups that the client needs, however I can't get them into the Organisation bit, I've setup a many_many relationship in the Organisation.php file:
static $many_many = array(
'TargetGroups' => 'TargetGroup'
However it's not pulling in the existing groups, it's only letting me create new ones the same way has_many does.
I'm rather stumped as the tutorial (#5 Dataobject Relationship Management) doesn't help, I tried adding the getCMSFields(); code to Organisation.php and it didn't add in anything.
I appreciate any help you can give me,
Edit: I meant to add, there will be quite a few many_many relationships in the database for GeographicalArea, Venues etc. Don't know if this affects any of the code, wouldn't have thought so but just incase
22 July 2010 at 10:11pm Last edited: 22 July 2010 10:11pm
Problem solved thanks to this thread: http://ssorg.bigbird.silverstripe.com/general-questions/show/279173
Only found thanks to some magic Googling. lol.
|Go to Top|