diff --git a/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php b/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php index 34038c6a1..a4f5dcc6e 100644 --- a/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php @@ -587,12 +587,11 @@ class ManyToManyPersister extends AbstractCollectionPersister . ' WHERE ' . implode(' AND ', $whereClauses); $stmt = $this->conn->executeQuery($sql, $params); - $hydrator = $this->em->newHydrator(Query::HYDRATE_ARRAY); + $hydrator = $this->em->newHydrator(Query::HYDRATE_OBJECT); $rsm = new Query\ResultSetMapping(); $rsm->addEntityResult($mapping['targetEntity'], 'r'); -$result = $hydrator->hydrateAll($stmt, $rsm); - var_dump($result); + return $hydrator->hydrateAll($stmt, $rsm); } diff --git a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php index bc97128cc..b7e23576c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ManyToManyBasicAssociationTest.php @@ -389,9 +389,14 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa $groups = $user->groups; $this->assertFalse($user->groups->isInitialized(), "Pre-condition: lazy collection"); - $criteria = Criteria::create();//->where(Criteria::expr()->eq('name', (string) 'Developers_0')); + $criteria = Criteria::create()->where(Criteria::expr()->eq('name', (string) 'Developers_0')); $result = $groups->matching($criteria); - //$this->assertCount(1, $result); + $this->assertCount(1, $result); + + $firstGroup = $result->first(); + $this->assertEquals('Developers_0', $firstGroup->name); + + $this->assertFalse($user->groups->isInitialized(), "Post-condition: matching does not initialize collection"); } }