This topic contains 4 replies, has 2 voices, and was last updated by archy_bold 8 years ago.
- Topic
Hi there. I’ve come across a weird scenario where one of my datagrid filters doesn’t work and it seems to be because filter_by_having isn’t working correctly, at least in my case. Here’s the important parts from my datagrid.yml file:
1234567891011121314151617181920datagrid:grid-name:extended_entity_name: %customer_entity%source:type: ormquery:select:...- GROUP_CONCAT(orders.orderReference SEPARATOR ' ') AS orderReferencesfrom:- { table: %customer_entity%, alias: c }join:left:- { join: c.orders, alias: orders }filters:columns:orderReferences:type: stringdata_name: orderReferencesfilter_by_having: trueSo, as you can see, I’m trying to get all the order references for each customer into a column and then using that to filter on.
All seems to work well until I try to filter and I get the following error:
An exception occurred while executing 'SELECT count(t0_.id) AS sclr_0 FROM trueconn_customer t0_ LEFT JOIN trueconn_order t1_ ON t0_.id = t1_.customer_id AND (t1_.organization_id = 1) WHERE GROUP_CONCAT(t1_.order_reference SEPARATOR ' ') LIKE ? AND t0_.organization_id = 1' with params ["%uns%"]:
SQLSTATE[HY000]: General error: 1111 Invalid use of group function (500 Internal Server Error)
This query would work if the GROUP_CONCAT part was part of a HAVING statement rather than a WHERE, which I would think filter_by_having would do.
Is it a bug or is there more I’m missing?
Thanks,
Simon
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.