DB Query nested and/or

I am trying to build an array using the operand format, to pass into yii\db\Query::where()

I need the SQL WHERE to be:

WHERE (originator_status != 'closed) AND ((cu.lifetime_value BETWEEN 100 AND 500) OR (another condition) OR (another condition))

This is my array so far, I can’t figure out how to get it to do the above, any help gratefully received.





(

    [0] => or

    [1] => Array

        (

            [0] => !=

            [1] => originator_status

            [2] => closed

        )


    [2] => Array

        (

            [0] => between

            [1] => cu.lifetime_value

            [2] => 100

            [3] => 500

        )


)




Solved it




Array

(

    [0] => and

    [1] => Array

        (

            [0] => !=

            [1] => COALESCE(originator_status,"")

            [2] => closed

        )


    [2] => Array

        (

            [0] => or

            [1] => Array

                (

                    [0] => between

                    [1] => cu.average_order_value

                    [2] => 4

                    [3] => 88

                )


            [2] => Array

                (

                    [0] => between

                    [1] => cu.lifetime_value

                    [2] => 5

                    [3] => 50

                )


        )


)