symfony/symfony — pull request #2371 by Abhoryo (2011-10-10 12:28:33+00:00)
Title: Add validation_groups attribute to the FromView

Is it possible to add the `validation_groups` attribute from one Form to its FormView ?
We can find all the constraints of a form but not the validation groups passed in options when creating the form.

Why?

I create a bundle that performs automatic validations of a form in javascript.
It works fine but a user has to manually add this attribute to the viewForm if he wants to manage validation groups.

Example:

```php
createFormBuilder($task, array(
'validation_groups' => array('registration')))
->add('task', 'text')
->add('dueDate', 'date')
->getForm();

$formView = $form->createView();

// Add validation groups to the formView
if ($form->hasAttribute('validation_groups')) {
$formView->setAtrribute('validation_groups', $form->getAttribute('validation_groups'));
}

return $this->render('AcmeTaskBundle:Default:new.html.twig', array(
'form' => $formView,
));
}
```

Perhaps we can add all attributes of one from to its formView.