Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var $hasAndBelongsToMany = array(
- 'Course' => array(
- 'className' => 'Course',
- 'joinTable' => 'course_members',
- 'foreignKey' => 'user_id',
- 'associationForeignKey' => 'course_id',
- 'conditions' => '',
- 'order' => '',
- 'limit' => '',
- 'uniq' => false,
- 'finderQuery' => '',
- 'deleteQuery' => '',
- 'insertQuery' => ''
- ),
- 'School' => array(
- 'className' => 'School',
- 'joinTable' => 'school_members',
- 'foreignKey' => 'user_id',
- 'associationForeignKey' => 'school_id',
- 'conditions' => '',
- 'order' => '',
- 'limit' => '',
- 'uniq' => false,
- 'finderQuery' => '',
- 'deleteQuery' => '',
- 'insertQuery' => ''
- ),
- 'Team' => array(
- 'className' => 'Team',
- 'joinTable' => 'team_members',
- 'foreignKey' => 'user_id',
- 'associationForeignKey' => 'team_id',
- 'conditions' => '',
- 'order' => '',
- 'limit' => '',
- 'uniq' => false,
- 'finderQuery' => '',
- 'deleteQuery' => '',
- 'insertQuery' => ''
- )
- );
- SELECT
- `User`.`id`, `User`.`username`, `User`.`password`, `User`.`firstName`, `User`.`lastName`, `User`.`email
- `, `User`.`phone`, `User`.`streetAddress`, `User`.`city`, `User`.`province`, `User`.`country`, `User
- `.`postal`, `User`.`userlevel`, `User`.`modified`, `User`.`created`, `User`.`deleted`, `User`.`deleted_date
- ` FROM `users` AS `User` WHERE `User`.`id` = 6 AND `School`.`name` LIKE '%Test%' LIMIT 1
- $this->Recipe->Tag->find('all', array(
- 'conditions' => array('Tag.name' => 'Dessert')));
- $this->Recipe->bindModel(array('hasOne' => array('RecipesTag')));
- $this->Recipe->find('all', array(
- 'fields' => array('Recipe.*'),
- 'conditions' => array('RecipesTag.tag_id' => 124) // id of Dessert
- ));
- $this->Recipe->bindModel(array('hasOne' => array('RecipesTag',
- 'FilterTag' => array(
- 'className' => 'Tag',
- 'foreignKey' => false,
- 'conditions' => array('FilterTag.id = RecipesTag.tag_id')
- ))));
- $this->Recipe->find('all', array(
- 'fields' => array('Recipe.*'),
- 'conditions' => array('FilterTag.name' => 'Dessert')
- ));
Add Comment
Please, Sign In to add comment