私のCakeアプリでは、ユーザーモデルと、いいね、推薦、友情などのさまざまな関係について、いくつかの関係を築いています。
ただし、配列内で「User」を複数回繰り返したため、Cakeはこれを行った方法が気に入らないようです。それではどうすればよいですか?
public $hasAndBelongsToMany = array(
'User'=>array(
'className' => 'User',
'joinTable' => 'friends',
'with' => 'Friend',
'foreignKey' => 'user_id',
'associationForeignKey' => 'friend_id'
),
'User'=>array(
'className' => 'User',
'joinTable' => 'endorsements',
'with' => 'Endorsement',
'foreignKey' => 'user_id',
'associationForeignKey' => 'endorsed_id'
),
'Interest' => array('with' => 'InterestUser')
);