Hi Berhard,

I've managed to implement the callback. On validation the callback of
the domain object gets called which is fine. What is a bit unclear to
me is the following: Where do i put the validation constraints for
each field I want to validate? If I set them in the section
'properties' in the validation.yml I run into the same problem as
before as the validator complains, that the property doesn't exist in
my domainobject.

Having a look at the code (http://www.google.com/url?sa=D&q=https://
github.com/symfony/symfony/blob/form/src/Symfony/Component/Form/
Validator/DelegatingValidator.php) in the method validateForm I
recognize: $context->setCurrentProperty()

Do I have to do something like

$context->setCurrentProperty('<propertyName>');

where <propertyName> is the name of the property as defined in the
validation.yml?

Any help would appreciated,
regards,
Holger

On 17 Apr., 20:53, Holger <holger.k...@100days.de> wrote:
> Hi Bernhard,
>
> thanks for the quick reply! I'll have a look into it.
> Regards,
> Holger
>
> On 17 Apr., 18:09, Bernhard Schussek <bschus...@gmail.com> wrote:
>
> > Hi Holger,
>
> > You can use the Callback constraint for this purpose. You can see an
> > example of its usage in 
> > DelegatingValidator::validateFormData():https://github.com/symfony/symfony/blob/form/src/Symfony/Component/Fo...
>
> > What is necessary for this approach:
> > - a common base class for your domain objects
> > - a callback method either in that base class or a static callback
> > method somewhere else
> > - a Callback constraint for this base class 
> > (seehttps://github.com/symfony/symfony/blob/form/src/Symfony/Component/Fo...
> > for an example - if you use a method in your base class, you can
> > simply provide the name of that method instead of the {Class, Method}
> > array)
>
> > Bernhard

-- 
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