I discovered a very strange problem in TP5. In TP3.2, you can use multi-dimensional arrays in a where to set multiple query conditions (sub-conditions)
For example:
where([array('id'=>'1','username'=>'2'),array('username'=>'3','password'=>'4'),'_logic'=>'or'])->find();
The sql generated by this code is
WHERE ( id
= '1' AND username
= '2' ) OR ( username
= '3' AND password
= '4' ) LIMIT 1
The parenthesis above is a sub-condition, which is very clear. However, in TP5, the '_logic' field is no longer supported. Instead, the where and whereOr methods are used. It seems that SQL can no longer be generated in the form of sub-conditions. So, How can I write a complex where statement? Please give me some advice.
Arrays are supported:
You can directly use string query