php - Group and nest routes in Symfony 3

636

I currently work on a Symfony Project with a large number of namespaces and Bundles. Many of them share the same base route like so:

# /app/config/routing.yml
something:
  resource: "@SomethingBundle/Controller/"
  prefix:   /admin/something
  type:     annotation

Now, at least 10 other bundles use the/admin prefix as well, so I was wondering if there would be a way to group and nest them? I imagine something like this (pseudocode):

admin:
  prefix: /admin
  nested_resources:
    - something:
        resource: "@SomethingBundle/Controller/"
        prefix:   /something
        type:     annotation
    ...

People are also looking for solutions to the problem: regex - How to get the index of last word with an uppercase letter in PHP

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.