I set my Friend model with following relationship setting, it still doesn't
work.
var $belongsTo = array(
'Follower' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Following' => array(
'className' => 'User',
'foreignKey' => 'friend
On 2/24/2011 6:54 PM, pang wrote:
The problem is `Friend`.`friend_id` is left joined with
`Friend`.`id`. How to solve this problem ?
Give it a different alias.
E.g.:
public $belongsTo = array(
'MyFriend' => array('className' => 'Friend',
'foreignKey' => 'fr
I have a Model User, and another Model Friend. in the Friend Model, I
have 2 foreign keys user_id and friend_id, both points to the same
User Model. in this design, all the operations on Friend Model
doesn't work, find, delete.
The error is like this:
SQL Error: 1066: Not unique table/alias:
Finally I know why it failed when calling $this->paginate() function..
After many days googling, I find this :
http://www.sanisoft.com/blog/2008/03/03/unbindmodel-and-paginate-gotcha-in-cakephp-12/
So I must set 'false' as the second parameter for unbindModel(), and
bindModel() function. Then the