symfony - Symfony2 - Callback validator on collection -


in symfony2 i'm tying use callback validate form, callback never called. class wherein callback is, called in main form through collection.

here code...

main class :

class inscriptiontype extends abstracttype {     /**      * @param formbuilderinterface $builder      * @param array $options      */     public function buildform(formbuilderinterface $builder, array $options)     {         $builder             ->add('inscriptionreponses','collection',array('label'=>false,                                                            'type'=>new inscriptionreponsetype(),                                                            'error_bubbling'=>false,                                                            'by_reference'=>false))         ;     } } 

inscriptionreponse class :

use symfony\component\validator\constraints assert; use symfony\component\validator\executioncontextinterface;  /**  * inscriptionreponse  *  * @orm\table()  * @orm\entity(repositoryclass="ptolemee\colloquebundle\entity\inscriptionreponserepository")  * @assert\callback(methods={"formvalidation"})  */  class inscriptionreponse {      /* ... code ... */      public function formvalidation(executioncontextinterface $context)     {            die('not dying ?');     }      } 

i don't understand what's wrong... highly appreciated. tahnks.

nicolas.

base on written in documentation:

http://symfony.com/doc/current/reference/constraints/callback.html

instead of

/** * @assert\callback(methods={"formvalidation"})  */  class inscriptionreponse { 

you should move annotation above function itself

class inscriptionreponse {  /** * @assert\callback  */     public function formvalidation(executioncontextinterface $context)     {            die('not dying ?');     }   

the method used valid in version 2.3, use 2.4 now


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -