Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ManyToMany relation matching criteria ignores isNull(column) #5587

Closed
RusAlex opened this issue Jan 4, 2016 · 6 comments · Fixed by #10587
Closed

@ManyToMany relation matching criteria ignores isNull(column) #5587

RusAlex opened this issue Jan 4, 2016 · 6 comments · Fixed by #10587

Comments

@RusAlex
Copy link

RusAlex commented Jan 4, 2016

I have an entity class where ManyMany relation described.

Then Im trying to do something like

public function getActiveRel()
{
   $criteria = Criteria::create()
   ->where(Criteria::expr()->isNull('column'));

   return $this->rel->matching($criteria);
}

IsNull condition is ignored in SqlValueVisitor.php
https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Persisters/SqlValueVisitor.php#L57

And no any IS NULL in final SQL statement.

@RusAlex
Copy link
Author

RusAlex commented Jan 4, 2016

@waltertamboer
Copy link

I can confirm that this is happening. I'm also experiencing this issue.

@oprokidnev
Copy link
Contributor

Still happening in 2k19.
In my case managed to solve by multiple collection transformation.

        $this->collection->matching(
            \Doctrine\Common\Collections\Criteria::create()
        )->matching(
            \Doctrine\Common\Collections\Criteria::create()->where(
                \Doctrine\Common\Collections\Criteria::expr()->isNull('deletedAt')
            )
        )

Problem is with
\Doctrine\ORM\Persisters\Collection\ManyToManyPersister::expandCriteriaParameters

It uses SqlValueVisitor that does not understand Comparison::EQ expression with null values.

@ThomasLabstep
Copy link

Still an issue.

ManyToMany + isNull Criteria is 100% not working.

Thx for the pointer to SqlValueVisitor.

I guess we need a little PR to add the use case to support isNull?

@beberlei beberlei added this to the 2.7.2 milestone Feb 16, 2020
@beberlei beberlei modified the milestones: 2.7.2, 2.7.3 Mar 21, 2020
@beberlei beberlei modified the milestones: 2.7.3, 2.7.4 May 26, 2020
@beberlei beberlei modified the milestones: 2.7.4, 2.7.5 Oct 11, 2020
@beberlei beberlei modified the milestones: 2.7.5, 2.7.6 Dec 4, 2020
@greg0ire greg0ire removed this from the 2.7.6 milestone Dec 5, 2020
@astronati
Copy link

@beberlei news about this issue? @MatTheCat

@MatTheCat
Copy link
Contributor

Well #10587 is open so maintainers will look at it when they’ll got time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants