/** * validate entity * * @return array */ public function validate() { $errors = parent::validate(); if ($this->getNameSingular() == $this->getNamePlural()) { $errors[$this->getValidationErrorKey('name_plural')][] = __('Singular and Plural names should not be the same'); } foreach ($this->getAttributes() as $attribute) { $attributeErrors = $attribute->validate(); $errors = array_merge($errors, $attributeErrors); } $nameAttribute = $this->getNameAttribute(); if (is_null($nameAttribute)) { $errors[''][] = __('Entity "%1" does not have an attribute that behaves as name', $this->getLabelSingular()); } return $errors; }
/** * validate module * * @return array */ public function validate() { $errors = parent::validate(); $errors = array_merge($errors, $this->getSettings()->validate()); if (count($this->getEntities()) == 0) { $errors[''][] = __('Each module must contain at least one entity.'); } foreach ($this->getEntities() as $entity) { $entityErrors = $entity->validate(); $errors = array_merge($errors, $entityErrors); } return $errors; }