mardi 24 février 2015

Symfony2: Dynamically validate a form

I have a form, based on various objects, that is built dynamically, with fields read in DB. This works fine.


Now I need to validate the form, with rules that are explained in the DB. Example of vaidation:



if($myobject->getValue() !=== $value_from_db) then addViolation('bzzzz')


Any explanation I found on the internet is related to static validation. Is there no way to apply a validator to a form or an object, so that the $form->isValid() method considers it ?


Note: I use Propel and not Doctrine.


Aucun commentaire:

Enregistrer un commentaire