mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
ExpressionBuilder contains doesn't work for type INT #6296
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 @Stijn98s on GitHub (Sep 12, 2019).
Originally assigned to: @lcobucci on GitHub.
Bug Report
I want to filter entities with a Criteria. When using the contains from the ExpressionBuilder on VARCHAR fields it works correctly. When using this on INT fields i get nothing.
When using the contains on VARCHAR i get correct entities back.
Current behavior
If i use
contains('name', 'test')from a table likeI correctly get
But when i use
contains('age', 1)I getHow to reproduce
Expected behavior
I expect i get the following
@lcobucci commented on GitHub (Sep 13, 2019):
@Stijn98s that's expected.
ExpressionBuilder#contains()is converted toage LIKE '%1%', which is invalid for numeric columns (it should even throw an exception on stricter platforms like PGSQL).I don't think you'll be able to achieve what you want using the Criteria API.
@lcobucci commented on GitHub (Sep 13, 2019):
Will close this as
invalidas per my explanation. Please reopen if needed.