Hi Benrnard and everyone.

This worked for me too.

>From annotations works fine, but how I would have to call it from
validation.yml?

#Application/MyBundle/Resources/config/validation.yml
Application\MyBundle\Entity\Anything:
  getters:
    address:
      - NotBlank: ~
      - IpAddress: ~

Thanks in advance.

On 24 nov, 20:33, Gustavo Adrian <comfortablynum...@gmail.com> wrote:
> I've just updated symfony 2 and now it works like a charm.
>
> Thanks.
>
> On Tue, Nov 23, 2010 at 1:05 PM, Gustavo Adrian <comfortablynum...@gmail.com
>
>
>
>
>
>
>
> > wrote:
> > Hi Bernhard,
>
> > I updated my config.yml and added:
>
> > app.config:
>
> >      validation:
> >            enabled: true
> >            annotations:
> >                 namespaces:
> >                      mybundle:
> >  Application\MyBundle\Component\Validator\Constraints\
>
> > And now in my Entity:
>
> > /**
> >   * @orm:Column(type="string", length="16")
> >   * @validation:NotBlank()
> >   * @mybundle:IpAddress()
> >   */
>
> > But I couldn't get it to work. I tried if NotBlank is still working but it
> > doesn't work now. Did I miss something?
>
> > I updated the pastebin codes correcting some typos just in case:
>
> > Constraint:http://pastebin.com/gGJKpc3Z
> > Constraint Validator:http://pastebin.com/U685DjV5
>
> > Checked if the "isValid" method is getting called on my custom constraint
> > validator, but it's not.
>
> > Thanks in advance for your help!
>
> > On Tue, Nov 23, 2010 at 12:28 PM, Bernhard Schussek 
> > <bschus...@gmail.com>wrote:
>
> >> 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 <comfortablynum...@gmail.com>:
> >> > 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....
> >> > 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 symfony-users@googlegroups.com
> >> > To unsubscribe from this group, send email to
> >> > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@goog
> >> >  legroups.com>
> >> > 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 symfony-users@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@goog
> >>  legroups.com>
> >> 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 symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to