Inserting new data with associated HABTM
I have a form that contains a habtm input. The array sent into the
Business model on an insert looks a little like this:
[Business] => Array
(
[address_1] => xxx
[...other fields...]
[Profession] => Array
(
[0] => 32
[1] => 19
[2] => 30
)
)
Note there is no field for Business.id as it is a new record.
This command in the Business model:
$this->save($business)
...creates the new Business record, but not the Profession habtm
records.
$this->save($business['Business']) does the same thing.
I thought that when I save the containing model the habtm records
would also be inserted? What am I doing wrong?
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home