ユーザーとグループ用の HABTM があります。グループ ビューに表示したい - ユーザーに属するすべてのグループ。別の言い方をすれば、ユーザーを持つすべてのグループです。
私は MVC に絡まっていて、それを理解することができません。ここに私の 2 つのモデルがあります: class Course extends AppModel
public $name = 'Course';
public $hasAndBelongsToMany = array('User' =>
array(
'unique' => false
)
);
と...
public $name = 'User';
public $hasAndBelongsToMany = array('Course' =>
array(
'unique' => true
)
);
データベース内のテーブル名はcourses_users
- このテーブルにはグループ ID とユーザー ID が格納されています。
十分に単純なはずですが、私は CakePHP を初めて使用するので、助けていただければ幸いです。ありがとうございました!