From 89e7e8623c257698bc61c40debc42fab3dcfd476 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 2 Jan 2011 13:43:49 +0100 Subject: [PATCH] DDC-546 - Remove dynamic public property approach in PersistentCollection::count() EXTRA_LAZY. --- lib/Doctrine/ORM/PersistentCollection.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index 0732dd01c..e104593bb 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -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();