Editor Query - Where Clause Issue

Editor Query - Where Clause Issue

aziegler3aziegler3 Posts: 21Questions: 3Answers: 0
edited May 2013 in Editor
In the php\lib\Database\Query.php code, under Editor, lines 407-418, there is an example on the usage of the where statement.

This specific example shows how to configure a sequence of AND and OR conditions.

Here is the code:



* @example

* The following will produce

* `'WHERE name='allan' AND ( location='Scotland' OR location='Canada' )`:

*

*

* $query

* ->where( 'name', 'allan' )

* ->where( function ($q) {

* $q->where( 'location', 'Scotland' );

* $q->where( 'location', 'Canada' );

* } );

*



When I use this pattern trying to execute an OR condition (replacing the specific field names and values by ours), it produces and AND where clause condition as follows:

'WHERE name='allan' AND ( location='Scotland' AND location='Canada' )`


Thus, the query returns no records in our case. If I comment out the second where in the function (i.e., the one with ‘Canada’), it returns the records that is supposed to, as a validation that the database connectivity and other settings are working properly.


We are using Editor 1.2.2

I am wondering if they can suggest what may be wrong or if there is a patch in the near future that may fix this issue.
This discussion has been closed.