symfony/symfony — Issue #3219: `cascade_validation` doesn't work with `validation_groups`
Author: craue
Created: 2012-01-30 11:42:10+00:00
State: open

With #3128, using `cascade_validation` doesn't work as expected when `validation_groups` are involved, while using `@Valid` would.

Let me try to illustrate the issue:

```php
add('name');
$builder->add('address', 'form_type_address', array(
'data_class' => get_class(new Address()),
));
}
}

// child form
class EditAddressFormType {
public function buildForm(FormBuilder $builder, array $options) {
$builder->add('street');
}
public function getName() {
return 'form_type_address';
}
}

// in a Controller
$author = new Author();
$author->setAddress(new Address());
$createAuthorForm = $this->createForm(new CreateAuthorFormType(), $author, array(
'validation_groups' => 'bla',
'cascade_validation' => true,
));
// ...
if ($createAuthorForm->isValid()) {
// ISSUE: will be valid even if street is empty
}
```