Skip to content

Instantly share code, notes, and snippets.

@slywalker
Created March 9, 2010 03:35
Show Gist options
  • Save slywalker/326123 to your computer and use it in GitHub Desktop.
Save slywalker/326123 to your computer and use it in GitHub Desktop.
<?php
class Post extends AppModel {
var $name = 'Post';
var $validate = array(
'user_id' => array('numeric'),
'title' => array('notempty')
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
var $hasAndBelongsToMany = array(
'Tag' => array(
'className' => 'Tag',
'joinTable' => 'posts_tags',
'foreignKey' => 'post_id',
'associationForeignKey' => 'tag_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment