mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
isNull criteria doesn't work #6239
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 @BenWaNH on GitHub (May 22, 2019).
Originally assigned to: @BenWaNH on GitHub.
Hi,
i've an issue with isNull method from Expression class
this is an example i use in my entity :
And this is the result SQL from log :
No trace about IS NULL
And If i try to replace my validityStart variable by another whose doesn't exist, no error returned
But if i replace isNull method by eq method an error is trigger ... It seems to skip my expression when isNull...
Thanks for reading
BenWa
@Ocramius commented on GitHub (May 22, 2019):
@BenWaNH would you be able to write a test case that reproduces this issue? See https://github.com/doctrine/doctrine2/tree/master/tests/Doctrine/Tests/ORM/Functional/Ticket for examples.
@BenWaNH commented on GitHub (May 22, 2019):
Yes, I will write it next week. I have to stay my time for this week and I will use the filter in the meantime.
Thanks
@thicolares commented on GitHub (Oct 20, 2019):
Hey @BenWaNH , I've created a test case for that, but I was not able to reproduce the error (version 2.7). Looks good to me. I took the opportunity to create a functional test that demonstrates that. See #7874.
If so, maybe we could close this issue.
@hason commented on GitHub (Mar 18, 2020):
@thicolares This issue is valid for ManyToManyPersister and SqlValueVisitor https://github.com/doctrine/orm/blob/master/lib/Doctrine/ORM/Persisters/SqlValueVisitor.php#L32-L36
@ndench commented on GitHub (Aug 28, 2020):
I can confirm that this issue exists for ManyToMany relationships but not for ManyToOne relationships.
Our entity model looks like this:
Doing a
Criteria::expr()->isNull('archivedAt')onOrganisation::templateTypescorrectly filters out archived TemplateTypes.Doing a
Criteria::expr()->isNull('archivedAt')onTemplate::templateTypeswhentemplateTypesis uninitialized does not filter correctly becausearchived_at IS NULLis left off the SQL query.However, if
templateTypesis initialized, then Criteria usesarray_filterand it works as expected.So the issue is only present when calling
PersistentCollection::matchingwith an uninitialized collection with an many to many association.@ndench commented on GitHub (Dec 22, 2021):
For anyone else who stumbles across this, I've been manually filtering these as a workaround:
@MatTheCat commented on GitHub (Mar 21, 2023):
Just got hit by this one while calling
matchingon a lazy (happens with bothLAZYorEXTRA_LAZY) collection.BTW this issue seems to duplicate https://github.com/doctrine/orm/issues/5587 and https://github.com/doctrine/orm/issues/5827