Search code examples
symfonysonata-adminsymfony-sonata

What does _sonata_admin: {resource: . } do in routing.yml?


When setting up SonataAdmin, you have to add an entry like this one:

_sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /admin

In this entry, what does resource: . do? It's somewhat unusual syntax and I'd like to add a footnote about it to the SonataAdmin docs.


Solution

  • The routing component needs a resource attribute (at least with sf2.0). The AdminPoolLoader class is in charge on loading the route and the support method only check the type attribute and not the resource name provided ....

    So the dot is just a value that others RoutingLoader cannot validate and generate errors...