The routing configuration for this sonata administrator can be found in
// vendor/bundles/Sonata/AdminBundle/Resources/config/routing/sonata_admin.xml <route id="sonata_admin_dashboard" pattern="/dashboard"> <default key="_controller">SonataAdminBundle:Core:dashboard</default> </route>
Say you have a package called "My / AdminBundle" that contains a controller that should extend dashboardActions. Then try the following:
Create a controller in /My/AdminBundle/Controller/CoreController.php
namespace My\AdminBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpFoundation\Response; use Sonata\AdminBundle\Controller\CoreController as BaseCoreContBroller; class CoreController extends BaseCoreContBroller { public function dashboardAction() {
Open the bundle routing configuration file located at /My/AdminBundle/Resources/config/routing.yml (you may have a different configuration format such as xml)
sonata_admin_dashboard:
pattern: / dashboard
defaults: {_controller: MyAdminBundle: Core: dashboard}
- Open the application routing configuration file and add the following after setting up the sonata so that it cancels it.
admin:
resource: '@ SonataAdminBundle / Resources / config / routing / sonata_admin.xml'
prefix: / admin
_sonata_admin:
resource:.
type: sonata_admin
prefix: / admin
MyAdminBundle:
resource: "@ MyAdminBundle / Resources / config / routing.yml"
prefix: / admin
Disclaimer so that you know that I have not used this in a project. I just check it locally and it worked. This may not be the best solution!
Hope this helps
source share