Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use existing Symfony FormType in Sonata Admin Bundle configureFormFields?

SonataAdminBundle gives a method configureFormFields when you extend the Admin class.

That method takes a FormMapper class.

For the entity that I have created this class for, I have already built a FormType class in the typical Symfony fashion.

How can I use that class instead of having to define the form properties again using the FormMapper?

like image 870
user1906994 Avatar asked Dec 15 '12 22:12

user1906994


1 Answers

something like:

public function configureFormFields(FormMapper $formMapper)
{        
    $form = new ReviewFormType();
    $form->buildForm($formMapper->getFormBuilder(),array());
}
like image 89
bigmax Avatar answered Nov 02 '22 21:11

bigmax