cakephp OR condition

后端 未结 3 1984
失恋的感觉
失恋的感觉 2021-01-07 21:22

Originaly posted on cakephp Q&A but i\'ll put it up here in hope of getting some answers.

I have a bunch of companies that has a status of 0 as default but somet

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-07 22:19

    Try

    'Company' => array (
        'conditions' =>  array (
            'OR' => array(
                array('Company.status' => 0),
                array('Company.status' => $status),
            )
    
        )
    )
    

    In the cookbook it says to wrap the or conditions in arrays if they are pertaining to the same field http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#complex-find-conditions

提交回复
热议问题