You can use validation group.

Every constraint may relate to one or more groups. When you create a form, 
you can specify validation group.

For example:

# validation.yml
    Acme\DefaultBundle\Entity\Blog:
        properties:
            title:
                - NotBlank:
                    message: Title field is required.
                    groups:  ['Edit', 'New']


    // edit action
    $form = $this->get('form.factory')->create($blogType, $blog, array(
        'validation_groups' => array('Edit')
    ));
    
    // search action
    $form = $this->get('form.factory')->create($blogType, $blog, array(
        'validation_groups' => array('Search')
    ));


If the second case does not specify a group, then will use the default 
group, which is added to all the constraints.

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