1
0
mirror of synced 2025-02-28 01:43:20 +03:00

DDC-546 - Remove dynamic public property approach in PersistentCollection::count() EXTRA_LAZY.

This commit is contained in:
Benjamin Eberlei 2011-01-02 13:43:49 +01:00
parent cbfdf61976
commit 89e7e8623c

@ -466,14 +466,9 @@ final class PersistentCollection implements Collection
public function count() public function count()
{ {
if (!$this->initialized && $this->association['fetch'] == Mapping\ClassMetadataInfo::FETCH_EXTRALAZY) { if (!$this->initialized && $this->association['fetch'] == Mapping\ClassMetadataInfo::FETCH_EXTRALAZY) {
// use a dynamic public property here. That may be slower, but its not using so much return $this->em->getUnitOfWork()
// memory as having a count variable in each collection. ->getCollectionPersister($this->association)
if (!isset($this->doctrineCollectionCount)) { ->count($this) + $this->coll->count();
$this->doctrineCollectionCount = $this->em->getUnitOfWork()
->getCollectionPersister($this->association)
->count($this);
}
return $this->doctrineCollectionCount + $this->coll->count();
} }
$this->initialize(); $this->initialize();