XF 2.2 Finder fetch(): I need to apply HAVING on the query or other method

Scandal

Well-known member
Hello all!
I'm using the XF:User finder to select some users.
XF:User has a TO_ONE relation, let's say it Orders (db table xf_sc_orders) and joined via user_id column.

I need do a fetch() with HAVING COUNT(xf_sc_orders.order_id) <= 1

How could I achieve it? Does Finder supports HAVING?
If no, any hint how could I extend only the XF:User finder to achieve this query?

I need to select those users with the most efficient method.

Let me know also if I could make it via modifying the $structure->relations['Orders'] conditions subarray or other subarray etc.

Thanks in advance :)
 
Back
Top Bottom