diff options
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/TaskValidator.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/app/Model/TaskValidator.php b/app/Model/TaskValidator.php index 461c03d4..1c7b0b14 100644 --- a/app/Model/TaskValidator.php +++ b/app/Model/TaskValidator.php @@ -79,7 +79,7 @@ class TaskValidator extends Base } /** - * Validate task modification + * Validate task modification (form) * * @access public * @param array $values Form values @@ -89,6 +89,28 @@ class TaskValidator extends Base { $rules = array( new Validators\Required('id', t('The id is required')), + new Validators\Required('title', t('The title is required')), + ); + + $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); + + return array( + $v->execute(), + $v->getErrors() + ); + } + + /** + * Validate task modification (Api) + * + * @access public + * @param array $values Form values + * @return array $valid, $errors [0] = Success or not, [1] = List of errors + */ + public function validateApiModification(array $values) + { + $rules = array( + new Validators\Required('id', t('The id is required')), ); $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); |