DDC-1632 Optimized query count for one-to-many associations with fetch eager.
This commit is contained in:
parent
4029dc2ea8
commit
b28fa9a05a
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user