symfony/symfony — pull request #2715 by acasademont (2011-11-24 13:27:10+00:00)
Title: [Form] Possibility to set readOnly and attributes

Digging more inside Form Event Subscribers i found very useful to set a form field as read only and then, based on the data, reverse the read only condition. Without this methods, i am forced to delete the child, create it again with the formFactory and add it to the main form, as the readOnly property is a private one. Same for attributes.

Before:
```php
if ($data->getId()) {
$form->add($this->factory->createNamed('text', 'name', null, array('read_only' => false)));
}
```

After:
```php
if ($data->getId()) {
$form->get('name')->setReadOnly(false);
}
```