Created
February 29, 2012 14:37
-
-
Save brandoncordell/1941247 to your computer and use it in GitHub Desktop.
saving habtm, many associated records at a time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// saving habtm, many associated records at a time | |
// Audit hasAndBelongsToMany User | |
// table: audits_users | |
$audit = array( | |
'Audit' => array( | |
'name' => 'My Audit', | |
'start_date' => '2012-02-10, | |
'end_date' => '2012-03-10' | |
) | |
); | |
$users = array( | |
array( | |
'id' => 12, | |
'id' => 14, | |
'id' => 15, | |
'id' => 16 | |
) | |
); | |
$this->data['Audit'] = $audit; | |
$this->data['User'] = $users; | |
$this->Audit->save($this->data); | |
?> |
rchavik
commented
Feb 29, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment