/** * Validates all the entities in the space. Return true if all the entities * pass the validation or a set of entities that failed the validation.If a $failed variable * is passed by reference, then a set of failed entities will be returend * * @param mixed &$failed Return the failed set * * @return boolean Return if all the entities passed the validations */ public function validateEntities(&$failed = null) { $restult = true; $failed = new AnObjectSet(); foreach ($this->getCommitables() as $entity) { $restult = $entity->getRepository()->validate($entity); if ($restult === false) { $failed->insert($entity); } } return $failed->count() === 0; }
/** * Count Data. * * @param booelan $load If the flag is set to on. If the qurey is set, it will * perform a count query instead of loading all the objects * * @return int */ public function count($load = true) { //if query is set, and the data is not loaded //lets use the query to get the count if (isset($this->_query) && !$this->isLoaded() && !$load) { $query = AnDomainQuery::getInstance($this->getRepository(), $this->_query); return $query->fetchValue('count(*)'); } else { $this->_loadData(); $result = parent::count(); } return $result; }