mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #8375] Support for Array parameters in SQL filters #10953
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/8375
State: closed
Merged: Yes
Supersedes https://github.com/doctrine/orm/pull/5571 by @mnogales
Fixes #2624
The original PR had a conceptual problem by putting the array detection directly into
getParameter(), but this could be a BC break for array DBAL types and it could be a risk, because the generated SQL must be written by the filter implementor, so magically returning a quoted list instead a quoted value could break things.Instead you must combine your generated SQL IN query with
$this->getParameterList($name):To use
getParameterListyou must also pass the values using the newsetParameterListmethod. It does not support type inference as we don't need to inspect the array elements then (which could be different).Passing a list/single value and retrieving a single/list value (mixed up) will throw a new
FilterException.