Find where id is not in array of ids

前端 未结 1 1590
礼貌的吻别
礼貌的吻别 2021-02-12 16:08

To find id whose value is equal to the id of an array of ids:

$this->YourModel->find(\'all\', array(
    \'conditions\' => array(
        \"YourModel.id         


        
相关标签:
1条回答
  • 2021-02-12 16:40

    This should work:

    $this->YourModel->find('all', array(
        'conditions' => array(
            "NOT" => array( "YourModel.id" => array(1, 2, 3, 4) )
        )
    ));
    

    http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#complex-find-conditions

    0 讨论(0)
提交回复
热议问题