HABTM
"Has and Belongs To Many"
A "Post" may have many "Tags" and may belong to many tags
In Post's Model
"Has and Belongs To Many"
A "Post" may have many "Tags" and may belong to many tags
In Post's Model
public $hasAndBelongsToMany = array(
'Tag' => array(
'className' => 'Tag',
'joinTable' => 'posts_tags',
'foreignKey' => 'post_id',
'associationForeignKey' => 'tag_id',
'unique' => 'keepExisting',
)
);
No comments:
Post a Comment