我想在 find('all' on cake 中输入一些条件。这是我的逻辑:
Traduction.traductions = my username AND Traduction.status = 1 OR 8
OR, Traduction.check1 = my username AND Traduction.status = 5 OR 2
OR, Traduction.check2 = my username AND Traduction.status = 6 OR 3
Or, Trauduction.editions = my username AND Traduction.status = 7 OR 3
如果这些条件之一是正确的,他会显示内容
到目前为止,这是我的代码
$conditions = array(
'AND' => array(
array(
'OR' => array(
array('Traduction.traductions' => $this->Session->read('Auth.User.username')),
array('Traduction.status' => '1'),
array('Traduction.status' => '8')
)
),
'AND' => array(
array(
'OR' => array(
array('Traduction.check1' => $this->Session->read('Auth.User.username')),
array('Traduction.check1' => '5'),
array('Traduction.check1' => '2')
)
)
),
'AND' => array(
array(
'OR' => array(
array('Traduction.check2' => $this->Session->read('Auth.User.username')),
array('Traduction.check2' => '6'),
array('Traduction.check2' => '3')
)
)
),
'AND' => array(
array(
'OR' => array(
array('Traduction.edition' => $this->Session->read('Auth.User.username')),
array('Traduction.edition' => '7'),
array('Traduction.edition' => '4')
)
)
),
)
);
$traduction = $this->Traduction->find('all', array(
'conditions' => $conditions
));
但可悲的是,它似乎不起作用。这里de sql转储
SELECT `Traduction`.`id`, `Traduction`.`serie`, `Traduction`.`issue`,
`Traduction`.`page`, `Traduction`.`writer`, `Traduction`.`drawer`,
`Traduction`.`release`, `Traduction`.`traductions`, `Traduction`.`check1`,
`Traduction`.`check2`, `Traduction`.`edition`, `Traduction`.`user_name`,
`Traduction`.`content`, `Traduction`.`status` FROM
`dcomicstrad`.`traductions` AS
`Traduction` WHERE ((((`Traduction`.`traductions` = 'DrWhat')
OR (`Traduction`.`status` = 1)
OR (`Traduction`.`status` = 8)))
AND (((`Traduction`.`edition` = 'DrWhat')
OR (`Traduction`.`edition` = '7')
OR (`Traduction`.`edition` = '4'))))
有人可以帮助我,我对所有这些数组 X_X 有点迷茫