私はMeiboomsの答えにコメントすることはできませんので、私は答えています。 HABTMリレーションとしてMember.club_id
フィールドがあってはいけないので間違っています。 は代わりに、何を持っている必要があることは、結合テーブルです:ClubsMembers.club_id
ClubsMembers.member_id
としては、何をする必要が偽のhasOneの関係が希望条件を設定することができるように結合され、あなたが言及し、関連する質問への答えで説明しました。あなたの特定のケースで
:あなたはContainableBehavior
を使用しない場合
$this->Club->Member->bindModel(array(
'hasOne' => array('ClubsMember')
), false);
// Set up the paginate options array
$this->paginate['Member'] = array(
'contain' => array(
'ClubsMember',
),
'conditions' => array(
'ClubsMember.club_id' => $club_id,
),
//Group since the HasOne may return multiple rows for each
//(if $club_id is an array of IDs and a Member is in more than one of those).
'group' => 'Member.id',
'order' => 'Member.name',
);
$this->set('members', $this->paginate('Member'));
がcontain
部分を無視します。 (ケーキはとにかくそれを無視します。)
最新バージョン、はい。私は朝にそれを試してみましょう。ありがとう。 –