Search code examples
phpsymfonysonata-admin

Find out where a Symfony route is defined?


I am working with a project that uses the Sonata Page Bundle.

After grepping all of my php files and settings files for the name of a route, I eventually found that it was being stored in the database, in a table called page__page.

My question is this: Is there an easy way to find out where a matched route is defined? Using the "profiler token" link on Symfony's debugging toolbar, I am at least able to get the name of the route, which is somewhat helpful. Unfortunately, that's where the default functionality appears to end.


Solution

  • You have a lot of ways to create and register routes.

    The more complex are the CMF and the custom loading.

    Symfony don't track which route is defined where and when. It only tracks the compiler_class used. You can display it by using

    bin/console debug:router page__page