db->getConnection(), Project::TABLE), ); } /** * Validate project creation * * @access public * @param array $values Form values * @return array $valid, $errors [0] = Success or not, [1] = List of errors */ public function validateCreation(array $values) { if (! empty($values['identifier'])) { $values['identifier'] = strtoupper($values['identifier']); } $v = new Validator($values, $this->commonValidationRules()); return array( $v->execute(), $v->getErrors() ); } /** * Validate project modification * * @access public * @param array $values Form values * @return array $valid, $errors [0] = Success or not, [1] = List of errors */ public function validateModification(array $values) { if (! empty($values['identifier'])) { $values['identifier'] = strtoupper($values['identifier']); } $rules = array( new Validators\Required('id', t('This value is required')), ); $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); return array( $v->execute(), $v->getErrors() ); } }