ryabenko-pro
ryabenko-pro

Reputation: 728

Hot to manipulate submitted data in Symfony 2 Forms Framework?

I have some MongoDB document related to some categories. Categories are stored in MongoDB document in tree structure with sequential ID for every category. In my entity document i have a field where i wanna store array of categories IDs in flat array instead of tree. In Symfony 1.4 with Doctrine ORM it was possible to manipulate submitted data in validator objects for a field or post validator for an entire form. I could totally transform submitted data into a different array and pass it to a object. How can I manipulate data in Symfony 2 Forms Framework?

Upvotes: 0

Views: 392

Answers (1)

AdrienBrault
AdrienBrault

Reputation: 7745

I think that the DataTransformers are what you need. You can find a cookbook entry in the official symfony documentation that explains how to use it : http://symfony.com/doc/current/cookbook/form/data_transformers.html

Upvotes: 1

Related Questions