Skip to content

Instantly share code, notes, and snippets.

@kyleslattery
Created July 28, 2008 16:06
Show Gist options
  • Save kyleslattery/2908 to your computer and use it in GitHub Desktop.
Save kyleslattery/2908 to your computer and use it in GitHub Desktop.
<?php
// show.php
class Show extends AppModel {
var $hasAndBelongsToMany = array('User');
}
// user.php
class User extends AppModel {
var $hasAndBelongsToMany = array('Show');
}
// Trying to add association between existing User and Show records:
// $show_id = existing show's id
// $user_id = existing user's id
$data = array('Show' => array('id' => $show_id), 'User' => array('id' => $user_id));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment