Le 04/01/2011 01:10, Lukas Kahwe Smith a écrit :
Aloha,

I am trying to make use of the custom validator provided by FOS\UserBundle:
https://github.com/FriendsOfSymfony/UserBundle/tree/master/Validator

I have setup the validation namespace on config.yml

app.config:
     validation:
         enabled: true
         annotations:
             namespaces:
                 fosuserbundlevalidator: Bundle\FOS\UserBundle\Validator

And I am using the namespace inside my Entity class:

class User extends BaseUser
{
     ...

     /**
      * @validation:NotBlank(message="Please enter an email", 
groups="Registration")
      * @validation:Email(message="This is not a valid email", 
groups="Registration")
      * @validation:MaxLength(limit=255, message="The email is too long", 
groups="Registration")
      * @fosuserbundlevalidator:Unique(property="email", message="The email is already in 
use", groups="Registration")
      *
      * @var string
      */
     protected $email;

     ...
}

However while all other validation rules seem to trigger, it seems like the 
custom validator is just ignored. I cannot even get it to register a syntax 
error.

regards,
Lukas Kahwe Smith
[email protected]



The FOS validator is a class validator. Look at https://github.com/FriendsOfSymfony/UserBundle/blob/master/Resources/config/validation.xml to see the rule (in XML, not annotations) If your class extends the UserBundle one, the validation rule is still there due to this file. It works well for me using the ORM.

--
Christophe | Stof

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to