Esempio n. 1
0
 public function validate()
 {
     $validator = new Validator();
     $validator->importRow('name', $this->name, ['IsNotEmpty'])->importRow('slug', $this->slug, ['IsNotEmpty', 'IsSlug'])->importRow('content', $this->content, ['IsNotEmpty'])->run();
     $errors = $validator->getErrors();
     if (false === empty($errors)) {
         throw new ValidationException($errors);
     }
 }
Esempio n. 2
0
 public function validator()
 {
     $validator = new Validator();
     $validator->importRow('name', $this->name, ['IsNotEmpty'])->importRow('slug', $this->slug, ['IsNotEmpty', 'IsSlug'])->importRow('content', $this->content, ['IsNotEmpty'])->run();
     return $validator;
 }