saveall not saving associated data
- by junior29101
I'm having a problem trying to save (update) some associated data. I've read about a million google returns, but nothing seems to be the solution. I'm at my wit's end and hope some kind soul here can help.
I'm using 1.3.0-RC4, my database is in InnoDB.
Course has many course_tees
CourseTee belongs to course
My controller function is pretty simple (I've made it as simple as possible):
if(!empty($this-data))
$this-Course-saveAll($this-data);
I've tried a lot of different variations of that $this-data['Course'], save($this-data), etc without luck.
It saves the Course info, but not the CourseTee stuff. I don't get an error message.
Since I don't know how many tees any given course will have, I generate the form inputs dynamically in a loop.
$form-input('CourseTee.'.$i.'.teeName', array('error' = false, 'label' = false, 'value'=$data['course_tees'][$i]['teeName']))
The course inputs are simpler:
$form-input('Course.hcp'.$j, array('error' = false, 'label' = false, 'class' = 'form_small_w', 'value'=$data['Course']['hcp'.$j]))
And this is how my data is formatted:
Array
(
[Course] = Array
(
[id] = 1028476
...
)
[CourseTee] = Array
(
[0] = Array
(
[key] = 636
[courseid] = 1028476
...
)
[1] = Array
(
[key] = 637
[courseid] = 1028476
...
)
...
)
)