开发者

problem displaying habtm relation of a specific user

I got 3 tables (Accessories, User, Accesories_Users)... At Accessories_Controller im trying just to get the accessories from the user logged in, so i set the recursive=1 and then execute the find...

The probl开发者_运维知识库em is, if i do

$this->Accessory->find("All", array('conditions'=>array('AccessoriesUser.user_id'=>$this->Auth->User('id'), 'AccessoriesUser.Accesory_id'=>'Accessory.id')));

theres an error cus it doesnt find Accessory_id field.... I could manage this using a custom query but is not the idea... And then even if i do the custom query solution i cannot paginate the array that the query return...

Thanks in advance for any help you can give me...


just use var $paginate = array('conditions'=>array()) and for habtm relations $this->model->bindModel('hasOne'=>aaray('otherModel'));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜