3460 Posts in 1064 Topics by 739 members
|Go to End|
23 March 2012 at 3:23am
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 database
I'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
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.
|Go to Top|