0
votes

Warning (512): Model "User" is not associated with model "User" [CORE\cake\libs\model\behaviors\containable.php, line 340]

im getting this error when accessing datas of photo, friend user has many photos and friend, photos and friend belongs to user

in photos index page, two warnings one for user mentioned above and other for 'Friend' as same friend is not associated with model 'friend'

what to do? what to check?

1
It would help to see some code. What does the find() call look like (and where is it happening) and how are the relevant associations defined on the Photo and Friend model.Rob Wilkerson
It sounds like you're making a $this->User->find() call with User in the contain option array, which is causing the error. It's also unnecessary, because the contain option is used to specify which other models, associated (directly or indirectly) with User, to retrieve.Daniel Wright

1 Answers

0
votes

You have some mismatch with assotiations.

You can have situation similar to this:

User habtm array("Friend"=> array("className"=>"User")

And when finding users:

$this->User->find("all", array(
   "contain"=>array("User");
));

instead of:

$this->User->find("all", array(
   "contain"=>array("Friend");
));

Check this or post some code :)