Пример #1
0
 /**
  * @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()));
     }
 }
Пример #2
0
 /**
  * @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;
         }
     }
 }