Added test for filtered eager joins#6037
Added test for filtered eager joins#6037nicoschoenmaker wants to merge 1 commit intodoctrine:old-prototype-3.xfrom
Conversation
lcobucci
left a comment
There was a problem hiding this comment.
Thanks for the work @nicoschoenmaker, could you please apply these changes?
| parent::setUp(); | ||
| try { | ||
| $this->_schemaTool->createSchema(array( | ||
| $this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Order'), |
There was a problem hiding this comment.
Please use the ::class syntax instead
| $this->_em->flush(); | ||
|
|
||
| $conf = $this->_em->getConfiguration(); | ||
| $conf->addFilter('visibility', '\Doctrine\Tests\ORM\Functional\VisibilityFilter'); |
There was a problem hiding this comment.
Please use the ::class syntax instead
| $order = $this->_em->find(Order::class, $order->getId()); | ||
| $count = count($order->getProduct()->getFeatures()); | ||
| self::assertContains( | ||
| 'Doctrine\Tests\ORM\Functional\Feature', |
There was a problem hiding this comment.
Please use the ::class syntax instead
| public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) | ||
| { | ||
| self::$classes[] = $targetEntity->name; | ||
| if ($targetEntity->name !== 'Doctrine\Tests\ORM\Functional\Feature') { |
There was a problem hiding this comment.
Please use the ::class syntax instead
| VisibilityFilter::$classes, | ||
| 'The VisibilityFilter should have been called for Feature.' | ||
| ); | ||
| self::assertSame(2, $count); |
There was a problem hiding this comment.
Please use self::assertCount() instead
462b4fa to
8eb9fa4
Compare
8eb9fa4 to
4461a6e
Compare
|
Thanks for the feedback @lcobucci. Updated |
|
|
||
| $order = $this->_em->find(Order::class, $order->getId()); | ||
| self::assertContains( | ||
| 'Doctrine\Tests\ORM\Functional\Feature', |
| private $visible; | ||
|
|
||
| /** | ||
| * @todo If we can't replicate it, this used to be Id |
| public function __construct($description, $visible = true) | ||
| { | ||
| $this->description = $description; | ||
| $this->visible = (bool)$visible; |
There was a problem hiding this comment.
Add space after closing parenthesis
|
There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. |
|
This pull request was closed due to inactivity. |
An
SQLFilteris not called on collections with eager loading enabled. This PR contains a unit-test that shows the problem.If I have
fetch="EAGER"enabledSQLFilter).then invisible features are still retrieved from the database!
This PR only contains a unit-test that shows the problem. The test passes if
fetch="EAGER"is removed.