@@ 690-706 (lines=17) @@ | ||
687 | $this->groupId2 = $group2->id; |
|
688 | } |
|
689 | ||
690 | public function testJoinSubclassPersister_FilterOnlyOnRootTableWhenFetchingSubEntity() |
|
691 | { |
|
692 | $this->loadCompanyJoinedSubclassFixtureData(); |
|
693 | // Persister |
|
694 | $this->assertEquals(2, count($this->_em->getRepository(CompanyManager::class)->findAll())); |
|
695 | // SQLWalker |
|
696 | $this->assertEquals(2, count($this->_em->createQuery("SELECT cm FROM Doctrine\Tests\Models\Company\CompanyManager cm")->getResult())); |
|
697 | ||
698 | // Enable the filter |
|
699 | $this->usePersonNameFilter('Guilh%'); |
|
700 | ||
701 | $managers = $this->_em->getRepository(CompanyManager::class)->findAll(); |
|
702 | $this->assertEquals(1, count($managers)); |
|
703 | $this->assertEquals("Guilherme", $managers[0]->getName()); |
|
704 | ||
705 | $this->assertEquals(1, count($this->_em->createQuery("SELECT cm FROM Doctrine\Tests\Models\Company\CompanyManager cm")->getResult())); |
|
706 | } |
|
707 | ||
708 | public function testJoinSubclassPersister_FilterOnlyOnRootTableWhenFetchingRootEntity() |
|
709 | { |
|
@@ 708-722 (lines=15) @@ | ||
705 | $this->assertEquals(1, count($this->_em->createQuery("SELECT cm FROM Doctrine\Tests\Models\Company\CompanyManager cm")->getResult())); |
|
706 | } |
|
707 | ||
708 | public function testJoinSubclassPersister_FilterOnlyOnRootTableWhenFetchingRootEntity() |
|
709 | { |
|
710 | $this->loadCompanyJoinedSubclassFixtureData(); |
|
711 | $this->assertEquals(3, count($this->_em->getRepository(CompanyPerson::class)->findAll())); |
|
712 | $this->assertEquals(3, count($this->_em->createQuery("SELECT cp FROM Doctrine\Tests\Models\Company\CompanyPerson cp")->getResult())); |
|
713 | ||
714 | // Enable the filter |
|
715 | $this->usePersonNameFilter('Guilh%'); |
|
716 | ||
717 | $persons = $this->_em->getRepository(CompanyPerson::class)->findAll(); |
|
718 | $this->assertEquals(1, count($persons)); |
|
719 | $this->assertEquals("Guilherme", $persons[0]->getName()); |
|
720 | ||
721 | $this->assertEquals(1, count($this->_em->createQuery("SELECT cp FROM Doctrine\Tests\Models\Company\CompanyPerson cp")->getResult())); |
|
722 | } |
|
723 | ||
724 | private function loadCompanyJoinedSubclassFixtureData() |
|
725 | { |