Fatal error : Declaration of {{path}}::validate() must be compatible with that of Sonata\AdminBundle\Admin\AdminInterface::validate()

You are trying to setup a custom validator on Sonata and you get this error :

Fatal error: Declaration of Adin\AdminBundle\Admin\AnnonceAdmin::validate() must be compatible with that of Sonata\AdminBundle\Admin\AdminInterface::validate() in /home/www/arlogis/src/Adin/AdminBundle/Admin/AnnonceAdmin.php on line 250

Don’t panic, just add this at the begining of your class

use Sonata\AdminBundle\Validator\ErrorElement;

in our example it’s in this file : /AdminBundle/Admin/AnnonceAdmin.php

Leave a Reply