1
0
mirror of synced 2025-02-20 22:23:14 +03:00

Use inner collection count if initialized

This commit is contained in:
Michaël Gallego 2013-12-19 20:48:09 +01:00 committed by Marco Pivetta
parent b556bcb16c
commit 9b7dce1940

View File

@ -53,13 +53,6 @@ class LazyCriteriaCollection implements Collection
*/
protected $initialized = false;
/**
* Allow to cache the count
*
* @var int
*/
protected $count;
/**
* @param BasicEntityPersister $entityPersister
* @param Criteria $criteria
@ -77,13 +70,11 @@ class LazyCriteriaCollection implements Collection
*/
public function count()
{
if (null !== $this->count) {
return $this->count;
if ($this->initialized) {
return $this->collection->count();
}
$this->count = $this->entityPersister->count($this->criteria);
return $this->count;
return $this->entityPersister->count($this->criteria);
}
/**