symphonists / symql

[Symphony 2] An SQL-like syntax for querying entries from Symphony CMS
Other
17 stars 5 forks source link

[0.7.0] Invalid filter settings in query #3

Closed vlad-ghita closed 8 years ago

vlad-ghita commented 12 years ago

I have this query (sort-order field is of type entry_order):

$query->select('title')
    ->from('news')
    ->where('sort-order', 'mysql: value < '.$param_pool['ds-single-news.sort-order'][0])
    ->perPage(1)
    ->page(1);

It will not return any results because the filters are messed-up in SymQL processing. On line 226 right before fetching entries, $where variable has this value:

AND t150_2.value IN ('mysql: value > 3')

when this is expected (entry_order field filtering SQL):

AND t150_2.value > 3

Any ideas?

vlad-ghita commented 12 years ago

Update:

Found the issue. SymQL calls buildDSRetrievalSQL() On line 198 and Entry Order implements the deprecated version buildDSRetrivalSQL() ... This is an Order Entries issue.

I noticed latest Order Entries has fixed this.

nickdunn commented 12 years ago

Ah good spot, yes. In fact SymQL should throw an exception if you try to filter on an invalid field, but the check itself still looks for the old method name! So you did actually discover a SymQL bug after all :-)

https://github.com/nickdunn/symql/blob/master/lib/class.symql.php#L168