mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
$expr->in(...) does not have the same behavior than ->where('foo IN ...')->setParameter(...) #6614
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 @VincentLanglet on GitHub (Jan 22, 2021).
Let's say I have an entity Foo and an entity Bar.
Foo::getBarreturns an ArrayCollection of Bar.When writing
the query will be
When writing
the query will be instead
where
name1,name2are the values returned byBar::__toString().I think this behavior misleading. Would it be possible to get some consistency ?
I'm afraid it required unfortunately a BC-break :(
@ShookTea commented on GitHub (Jan 22, 2021):
AFAIK
Exprworks on DBAL side of a Doctrine and you're trying to apply ORM elements to it. You're basically mixing two different ways of asking database for something ;)Try this instead, if you really need to use Expr:
@VincentLanglet commented on GitHub (Jan 22, 2021):
Yes, I agree I can transform my array to id instead.
And I don't need to use Expr.
But some dev in my team pref to use
expr, some others prefer to write('foo.bar IN (:bars). And having them writing something that looks like similar but which lead to different result is not helping them.It's the same that
is returning no result and
is throwing an exception.
I find these inconsistency tricky.