Closed
Description
Version 0.11.9 provided the ability to perform a WHERE EXISTS
query when referencing a hasMany property, but currently if you try to query deeper, it's applying the JOIN to the main SELECT
and not the subselect within the WHERE EXISTS
/api/v1/races?where={"events.event_category.name":{"==":"5k"}}
Current
select `race`.* from `race`
inner join `event_category` on `event`.`event_category_id` = `event_category`.`id`
where exists (
select `event`.* from `event` where `event_category` = '5k' and `event`.`race_id`=`race`.`id`
)
- ER_BAD_FIELD_ERROR: Unknown column 'event_category' in 'where clause'
Should produce
select `race`.* from `race`
where exists (
select `event`.* from `event`
inner join `event_category` on `event`.`event_category_id` = `event_category`.`id`
where `event_category` = '5k' and `event`.`race_id`=`race`.`id`
)
It looks to be an issue with closure within processRelationField. I believe the query will need to be passed in explicitly
Metadata
Metadata
Assignees
Labels
No labels