我有3张桌子
用户 UserHasBasicTheme(连接表user.id,user_theme.id) UserTheme
我想使用findAll方法通过给定的user.id获取All UserTheme
每张桌子都有自己的模型。
我尝试使用:
$this->UserTheme->bindModel(array('hasOne' => array('UserHasBasicTheme')));
$this->UserTheme->find('all', array(
'conditions' => array('UserHasBasicTheme.user_id' => $this->id)
));
但下面的例子是返回错误: 在非对象
上调用成员函数bindModel()我在用户控制器上调用它。
我想问一下,这怎么会是正确的?
感谢您的任何建议。
答案 0 :(得分:0)
您是否定义了$ uses属性?
public $uses = array('UserTheme', 'User', 'UserHasBasicTheme');
对于控制器?