Hi Gustavo,
Sorry, the documentation is lacking in that part. You need to register
your constraint namespace to use it with the validation driver. Add
this to your config.yml
validation:
enabled: true
annotations:
namespaces:
myvalidation:
Application\MyBundle\Component\Validator\Constraints\
Then you can refer to the constraint using @myvalidation:IpAddress.
Bernhard
--
Software Architect & Engineer
Blog: http://webmozarts.com
Twitter: http://twitter.com/webmozart
2010/11/23 Gustavo Adrian <[email protected]>:
> Hi everyone,
> I've created a custom validator for IP Addresses but is not getting called.
> What I did is simply copy the existent Url validator files (Url and
> UrlValidator), changed the pattern accordingly and removing some stuff
> (protocols, etc). Then in my Entity via annotations:
>
> /**
> * @orm:Column(type="string", length="16")
> * @validation:NotBlank()
> * @validation:IpAddress()
> */
> protected $primaryDns;
> NotBlank constraint is working, but my custom validator doesn't. I've put my
> files in
>
> Application/MyBundle/Component/Validator/Constraints/IpAddress.php
> Application/MyBundle/Component/Validator/Constraints/IpAddressValidator.php
>
>
> Am I missing some step? I've followed the docs
> from http://docs.symfony-reloaded.org/master/guides/validator/constraints.html
> My Constraint: http://pastebin.com/zcf8YQ3C
> My Constraint Validator: http://pastebin.com/uN9nqA6A
>
> Thanks in advance.
>
> --
> 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 users" 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-users?hl=en
>
--
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 users" 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-users?hl=en