Search code examples
phpsymfonysonata

Find the controller that a route is hitting in a Sonata project


I am working on a project based on Symfony 2.7 and the Sonata admin bundle. The project uses a workflow that includes an "unpublish" step. I want to modify the logic of that step.

Running app/console debug:router | grep unpublish gives me this:

admin_mycompany_app_video_unpublish                                 ANY      ANY    ANY  /admin/mycompany/app/video/{id}/unpublish/

... and searching for admin_mycompany_app_video_unpublish in my codebase finds only the following in appDevDebugProjectContainerUrlMatcher.php:

return $this->redirect($pathinfo.'/', 'admin_mycompany_app_video_unpublish');

So the route exists, but I cannot seem to find what controller it's pointing at.

Any suggestions for finding that controller?


Solution

  • You can find it in getRoutes() method of VideoAdmin it’s calculated on the fly based on naming conventions

    The corresponding code should be in VideoAdminController.

    Hope it helps