Doing all but HABTM with a multiple selectTag you have to manually
manage the foreignKey's.  What this means is you have to set it.
Usually this means that you create one records, get the last inserted
id, and use that as the foreignKey for the related records if you are
saving them all in the same action.

$this->ModelName1->save($this->data);
$related['ModelName2']['foreignKey'] =
$this->ModelName1->getLastInsertID();
$this->ModelName2->create();
$this->ModelName2->save($related);

Of course there is more code in there, more fields, maybe manipulation
of the $this->data array (if it has both model's information in it).
But that is almost always what you have to use if you don't have the
user setting the foreignKey (like picking the category for the new
option).


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to