3060 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 323 Views |
-
Trouble adding has_many children

23 March 2012 at 3:23am
Hi all
Bit of a newbie question, I'm sure, but I just can't find a solution to this problem. I suspect it's something I'm doing wrong but...
OK, I have a parent class with a has_many relationship with a child class. SilverStripe/Sapphire creates the tables correctly but I'm not able to insert any child objects into the database using SS. The steps I'm expecting to work for me are...
1. create new Parent object
2. get Children component set
3. create Child objects and use add() to add them to Children
4. call write() on Parent to write Parent and Children to databaseI'm not getting any error messages that I can find but nor am I getting any Child objects inserted into the database. I've done my best to find useful example code, read the documentation, etc. but I'm just stuck.
Could someone please point me at a complete example of achieving the above or highlight where I'm going wrong?
Thanks in advance
Simon -
Re: Trouble adding has_many children

27 June 2012 at 2:44am
Are you trying to do this on a front end form or in the CMS? I am doing something similar, but I'm trying to build out a front end form that will input the child relationships as well.
| 323 Views | ||
|
Page:
1
|
Go to Top |


