Fromage
Fromage

Reputation: 33

Symfony2: Add a prefix route to a bundle

I am working with Symfony2 and I have a bundle that includes multiple controllers. I want to have a common prefix route for all of them.

Something like this:

bundle_path/controller1_path
bundle_path/controller2_path
bundle_path/controller3_path

etc.

Is there a way to do this without writing bundle_path into every single controller?

Upvotes: 1

Views: 332

Answers (1)

Matteo
Matteo

Reputation: 39390

You can add a prefix to alle the bundle's route in the routing.yml files. As Example:

acme_customer_area_frontend:
    resource: "@AcmeCustomerAreaFrontendBundle/Resources/config/routing.yml"
    prefix:   /customer/frontend

Hope this help

Upvotes: 2

Related Questions