/** * @return int */ public function count() { if ($this->entitiesAreLoaded) { return parent::count(); } else { $entityClass = $this->entitiesClassName; $managerClass = $entityClass::entityInformation()->managerName; return $managerClass::countRecords(\obo\Carriers\QueryCarrier::instance()->addSpecification($this->getSpecification())); } }
/** * @param \obo\Interfaces\IQuerySpecification $specification * @return int */ public function count(\obo\Interfaces\IQuerySpecification $specification = null) { if ($specification !== null) { return $this->relationShip->countEntities($specification); } else { if ($this->entitiesAreLoaded) { return parent::count(); } elseif ($this->owner->isBasedInRepository()) { return $this->relationShip->countEntities(); } else { return 0; } } }