Serhii Polishchuk profile picture Serhii Polishchuk

Add ViewTransformer to SonataAdmin

Sep 23, 2014

Some time I can’t find how to add data transformer to SonataAdmin field. After some investigating I find answer. In configureFormFields method we have FormMapper instance from what we need to get FormBuilder. Add DataTransformer to FormBilder is simple: $formMapper->getFormBuilder()->get(‘field’)->addViewTransformer(new FieldTransformer());