1
0
mirror of synced 2025-01-31 04:21:44 +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

View File

@ -466,14 +466,9 @@ final class PersistentCollection implements Collection
public function count()
{
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
// memory as having a count variable in each collection.
if (!isset($this->doctrineCollectionCount)) {
$this->doctrineCollectionCount = $this->em->getUnitOfWork()
->getCollectionPersister($this->association)
->count($this);
}
return $this->doctrineCollectionCount + $this->coll->count();
return $this->em->getUnitOfWork()
->getCollectionPersister($this->association)
->count($this) + $this->coll->count();
}
$this->initialize();