Fix IN/NOT IN expression handling and support enums when matching on to-many-collections#11895
Conversation
5f4137b to
cf240eb
Compare
IN/NOT IN criteria/expression handling for to-many-ConnectionsIN/NOT IN expression handling and support enums when matching on to-many-collections
IN/NOT IN expression handling and support enums when matching on to-many-collectionsIN/NOT IN expression handling, support enums when matching on to-many-collections
IN/NOT IN expression handling, support enums when matching on to-many-collectionsIN/NOT IN expression handling and support enums when matching on to-many-collections
… on to-many-collections This fixes that using a `Criteria` with an `IN` or `NIN` expression on a to-many collection currently leads to an SQL error (doctrine#6173). The `ManyToMany` persister needs to know about the slightly different SQL syntax for `[NOT] IN ()`. In the case of `[NOT] IN` expressions, the value will be an array, which also required me to change (I guess "fix") the parameter type handling. I have pulled the necessary code from the `BasicEntityPersister` and placed it as static helper methods in `PersisterHelper`. This is somewhat inspired by doctrine#11516, which aims at fixing doctrine#11481: By re-using the parameter type handling code, it also fixes using backed enums in `EQ`, `IN` and `NIN` expressions within `Criteria` when `matching()` on one-to-many and many-to-many collections.
cf240eb to
9bf407f
Compare
kira0269
left a comment
There was a problem hiding this comment.
Nice work. More complete than mine.
|
There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. |
|
@derrabus Could you check this PR please ? |
|
As already mentioned in #11031 (comment) I tried this fix in my code base and it worked fine. Is any help needed in order to get this PR reviewed/merged? |
|
@mpdude hi! These changes brought an issue, if you pass an empty array to the IN expression, it creates an expression like this This call throws an exception now 2.20.6 version works fine @greg0ire fyi |
This fixes that using a
Criteriawith anINorNINexpression on a many-to-many collection currently leads to an SQL error (#6173). TheManyToManypersister needs to know about the slightly different SQL syntax for[NOT] IN ().In the case of
[NOT] INexpressions, the value will be an array, which also required me to change (fix?) the parameter type handling. I have pulled the necessary code from theBasicEntityPersisterand placed it as static helper methods inPersisterHelper.This is somewhat inspired by #11516, which aims at fixing #11481: By re-using the parameter type handling code, it also fixes using backed enums in
EQ,INandNINexpressions withinCriteriawhenmatching()on one-to-many and many-to-many collections.Fixes #6173, fixes #11031, fixes #11481, closes #11516.