Use inner collection count if initialized
This commit is contained in:
parent
b556bcb16c
commit
9b7dce1940
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user