How to implement SonataAdmin forms and lists into own controllers with different logic and templates?
How to implement SonataAdmin forms and lists into own controllers with different logic and
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I sugest you have a look at Sonata\AdminBundle\Controller\CRUDController, there you have everything you need:
Say you have an admin for ‘User’ entities and the service name for this admin is ‘myapp.admin.user’ (in services.xml or alike)
In your controller you can get the admin class with:
you can get the admin form with:
and if you look at the listAction() method in that class you can see how to get the datagrid for building the lists:
For the templates you can extend or adapt the templates at Sonta/AdminBundle/Resources/views/CRUD for the list and edit actions.