fix: allow array values for expression parameters#366
fix: allow array values for expression parameters#366spackmat wants to merge 3 commits intolexik:masterfrom
Conversation
Fixes the problem described in lexik#364 where array values for parameters of filter expressions are misinterpreted as [value, type] pairs, throwing strange errors within Doctrine. When the value (with an optional type) is wrapped inside a `ExpressionParameterValue` value object, the `DoctrineApplyFilterListener` detects and used that explicit declaration. When the value is an array, it is checked if it contains a valid DBAL-type string on the second element, before it is assumed that it contains an implicit type decleration in that old array form. That branch can be deprecated in favor of the explicit declaration using the new `ExpressionParameterValue` class.
In 5b99c11 the tests failed do to not updated assertions.
|
Hi @spackmat, Thx for the PR. I need to found a moment to check your PR, did you add tests? Because you have just change an existant test 🤔 |
I did not add tests for that case, because the fixtures don't contain a relation, on which an |
This changes the AbstractDoctrine- and DoctrineORMSubscriber to use the new `ExpressionParameterValue`
|
I also removed the internal usages of the old parameter-array-format and changed them to use the @trigger_error('Setting Expression parameters with array format `[$value, $type]` is deprecated, use `new ExpressionParameterValue($value, $type)` instead.', \E_USER_DEPRECATED); |
Fixes the problem described in #364 where array values for parameters of filter expressions are misinterpreted as [value, type] pairs, throwing strange errors within Doctrine.
When the value (with an optional type) is wrapped inside a
ExpressionParameterValuevalue object, theDoctrineApplyFilterListenerdetects and used that explicit declaration. When the value is an array, it is checked if it contains a valid DBAL-type string on the second element, before it is assumed that it contains an implicit type decleration in that old array form. That branch can be deprecated in favor of the explicit declaration using the newExpressionParameterValueclass.