symfony/symfony — pull request #2797 by acasademont (2011-12-07 11:07:32+00:00)
Title: [Form] setReadOnly and setAttribute on a Form after creation

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

In a From EventSubscriber i can manage to get the form via $event->getForm() but i am pretty limited about what can i do with that form. If i only want to change a the read_only property i can't because it's private, so i end up creating the field again with the same name and overwriting it with

```php
$form->add($this->factory->createNamed('text', 'name', null, array('read_only' => false)));
```

which is a bit time consuming since i only wanted to set the read_only property of that field to false.

I must say that i found it a bit strange that there weren't any options for doing this so please, tell me if there is any powerful reason for not being able to change the read_only (or other attributes) when the form is already created.