-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
The filtering of a relationship, when included in an $or clause as shown in https://abbasudo.github.io/laravel-purity/advanced/param.html#changing-params-source, causes the following kind of error:
Query: /users/?filters[$or][profile][name][$contains]=John
SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'WHERE' (Connection: mariadb, SQL: select count(*) as aggregate from `users` where ((`` LIKE %John%)))The raw query produced by Purity becomes:
select * from `users\` where \`\` LIKE '%John%'Whereas the same query without the OR works correctly: /users/?filters[profile][name][$contains]=John
And produces a correct query:
select * from `users` where exists (select * from `profiles` where `users`.`id_profile` = `profiles`.`id` and `name` LIKE '%John%')Note
The problem also occurs when using $or with conditions on NON-related columns.
Example: /users/?filters[$or][email][$contains]=@gmail&filters[$or][created_ate][$contains]=2025
Produces:
SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'WHERE' (Connection: mariadb, SQL: select count(* ) as aggregate from `users` where ((`` LIKE %@gmail@%) or (`` LIKE %2025%)))Metadata
Metadata
Assignees
Labels
No labels