symfony/symfony — pull request #3514 by Burgov (2012-03-06 12:32:32+00:00)
Title: Public transformers

Bug fix: No
Feature addition: Yes
Backwards compatibility break: No
Symfony2 tests pass: Yes
Fixes the following tickets: -

Especially when using the PRE_BIND and BIND_CLIENT_DATA listeners, it is very convenient to be use the transformers. I can fetch them using $form->getClientTransformers() and them looping over them, but that's just code duplication of what the form defines in it's private functions.

For example, someone enters country with ID 12, I fetch this in my listener, and want to create a new form element with a list of states in this country. I'd either have to inject the EntityManager into the listener, or use the transformers, to get the Country entity in order to fetch the states from it. The latter, IMO, is the best option, but since the transform methods are private, i have to rewrite them within my listener instead of being able to reuse Component code