mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Criteria is incorrectly serializing values on array field #6299
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?
Originally created by @hubertnnn on GitHub (Sep 18, 2019).
Bug Report
Summary
When trying to use Criteria on array type of field, the value is incorrectly serialized.
Field definition:
Criteria usage:
Current behavior
Generated SQL contains following where clause:
WHERE t0.roles LIKE 's:12:\"%ROLE_ADMIN%\";'Expected behavior
Where statement should not be serialized:
WHERE t0.roles LIKE '%ROLE_ADMIN%'or should be serialized before adding percent signs:
WHERE t0.roles LIKE '%s:10:\"ROLE_ADMIN\";%'@Ocramius commented on GitHub (Sep 18, 2019):
Hmm, seems correct behavior, since the conversion goes through SQL conversions in the DBAL type.
The problem is that it certainly isn't obvious to the consumer, but do imagine doing the same with a
DateTimeinstance: a conversion would most certainly be expected.EDIT: sorry, didn't mean to close