diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index 6504a3ee0..8604cc4fe 100644 --- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -1159,7 +1159,10 @@ class BasicEntityPersister implements EntityPersister $columnList[] = $assocColumnSQL; } - if ( ! (($assoc['type'] & ClassMetadata::TO_ONE) && ($assoc['fetch'] == ClassMetadata::FETCH_EAGER || !$assoc['isOwningSide']))) { + $isAssocToOneInverseSide = $assoc['type'] & ClassMetadata::TO_ONE && ! $assoc['isOwningSide']; + $isAssocFromOneEager = $assoc['type'] !== ClassMetadata::MANY_TO_MANY && $assoc['fetch'] === ClassMetadata::FETCH_EAGER; + + if ( ! ($isAssocFromOneEager || $isAssocToOneInverseSide)) { continue; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php index 75f34a25c..145b17330 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php @@ -38,11 +38,11 @@ class DDC2350Test extends OrmFunctionalTestCase $cnt = $this->getCurrentQueryCount(); $user = $this->_em->find(__NAMESPACE__ . '\DDC2350User', $user->id); - $this->assertEquals($cnt + 2, $this->getCurrentQueryCount()); + $this->assertEquals($cnt + 1, $this->getCurrentQueryCount()); $this->assertEquals(2, count($user->reportedBugs)); - $this->assertEquals($cnt + 2, $this->getCurrentQueryCount()); + $this->assertEquals($cnt + 1, $this->getCurrentQueryCount()); } }