public function validLoginStudentForm(LoginStudentForm $loginStudentForm) { $errors = new ErrorList(); if ($loginStudentForm->getEmail() === '') { $errors->setError('login', 'Email field is empty'); } if ($loginStudentForm->getPassword() === '') { $errors->setError('login', 'Password field is empty'); } return $errors; }
public function validStudent(Student $student) { $errors = new ErrorList(); foreach ($this->validations as $field => $validator) { $parameters = array(); foreach ($validator['parameters'] as $parameter) { $parameters[] = call_user_func([$student, $parameter]); } $errors->setError($field, call_user_func_array([$this, $validator['validator']], $parameters)); } return $errors; }