/**
  * {@inheritdoc}
  */
 public function count()
 {
     if (!$this->initialized && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) {
         $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association);
         return $persister->count($this) + ($this->isDirty ? $this->collection->count() : 0);
     }
     return parent::count();
 }