CakePHP正在忽略查找条件

CakePHP正在忽略查找条件,cakephp,Cakephp,我尝试从属于用户的锦标赛中检索所有数据库记录 $cond = array('condition' => array('Tournament.user_id' => $this->Auth->user('id'))); $data = $this->User->Tournament->find('all', $cond); 它发现所有的比赛,脚本似乎不关心的条件 用户hasandbelongtomany锦标赛。我在userscoontroller中创建了

我尝试从属于用户的锦标赛中检索所有数据库记录

$cond = array('condition' => array('Tournament.user_id' => $this->Auth->user('id')));
$data = $this->User->Tournament->find('all', $cond);
它发现所有的比赛,脚本似乎不关心的条件

用户
hasandbelongtomany
锦标赛
。我在
userscoontroller
中创建了一个名为“tournaments”的函数,其中包括上面的代码部分


我希望这是足够的信息,否则请告诉我需要什么,我稍后会提供。

您应该更仔细地阅读CakePHP文档:

conditions (not condition)

您应该更仔细地阅读CakePHP文档:

conditions (not condition)

为什么不只用一条线呢<代码>$data=$this->User->锦标赛->findAllByUserId($this->Auth->User('id'))为什么不只用一行<代码>$data=$this->User->锦标赛->findAllByUserId($this->Auth->User('id'))