-3

私はいくつかの条件を 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

    ));

しかし、残念ながらそれはうまくいかないようです。ここに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で少し迷っています.

4

2 に答える 2