I have 3 tables:
Managers (primaryKey = ManagerID)
Clients(primaryKey = ClientID).
clients_managers = (ClientID, ManagerID)
I had set this HABTM in Client model:
var $hasAndBelongsToMany = array('ServiceManager' => array('className'
=> 'Manager', 'foreignKey' => 'ManagerID', 'associationForeignKey' =>
'ClientID'));
Following the Cake-manual, i wrote this in my view:
<?= $html->selectTag('ServiceManager/ServiceManager', $managers, null,
null, null, false) ?>
$managers = array('ManagerID' => 'managers name')
After submit, if form contained hidden ClientID, cake makes 'Update
clients set ClientID = 1 where ClientID = 1' and 'Delete from
clients_managers where ManagerID = 1'. If there was no hidden ClientID,
cake makes insert in clients table with a single field 'created'.
What's wrong? How to save HABTM's correctly?
Thanks in advance. Excuse me my poor english :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---