Form validation failed on submit

I have built a form base on fieldset wich contains select Element. I created a factory for the fieldset to populate the select with database entries and everything is ok.
But in my controller I get this error when I call myform->isvalid(). Here is the error message




Argument 1 passed to Laminas\Validator\AbstractValidator::setTranslator() must be an instance of Laminas\Validator\Translator\TranslatorInterface or null, instance of Laminas\I18n\Translator\Translator given, called in C:\wamp\www\school-online\vendor\laminas\laminas-validator\src\ValidatorPluginManager.php on line 580

I need to precise that I have not setted yet the getInputFilter function and haven’t yet setted validator.

Here is my controller code :



    namespace Admin\Controller;

    use Laminas\View\Model\ViewModel;
    use Commun\Controller\NslabsAbstractController;
    use Commun\Form\Admin\ClasseForm;
    use Commun\Model\Entity\RefClasse;
    use Laminas\Hydrator\ArraySerializableHydrator;

    class AdministrationFonctionnelleController extends NslabsAbstractController
        //private $SM;    

        public function listeDesClassesAction()
            $mapperRefClasse = $this->SM->get('TREFCLASSE');               
            $classeForm = $this->formManager->get(ClasseForm::class);                
                return new ViewModel(['form' => $classeForm]);
            $refClasse  = new RefClasse();        
            $hydrator = new ArraySerializableHydrator(); 
               return new ViewModel(['form' => $classeForm]);
            $data = $hydrator->extract($refClasse);
            $additionnalData = [
                'idRefUtilisateurCreation' => $this->user->getIdRefUtilisateur(),           
            return $this->redirect()->toRoute('admin-fonctionnelle', ['action' =>  'liste-des-classes']);            

Please check if the package laminas-mvc-i18n is installed. If not, then make sure laminas-component-installer is installed then install laminas-mvc-i18n.

The component installer will register laminas-mvc-i18n in your application automatically.

Thank you again :smirk:
You’re awesome :+1: :+1: :+1:

Everything works fine

Great! :+1:

Can you provide a link to a GitHub Gist with your class Commun\Controller\NslabsAbstractController. It smells like a god object. :see_no_evil:

1 Like

OK ok. I will do it :hugs::hugs::hugs: