1
votes

I've got a question: Is it possible to create a routing rule in Symfony2 that picks the /bundle/controller/action/params from the URL?

The "abstract" routing.yml in my mind could look like that:

Directory{nameofbundle}Bundle:
    pattern:  /{nameofbundle}/{controller}/{action}/{params}
    defaults: { _controller: Directory{nameofbundle}Bundle:{controller}:{action}}

So if I'd go to the url www.myweb.com/Xyz/Asd/ffs/ it would launch: an action named ffsAction from AsdController from a bundle src/Asd/XyzBundle/

Is this possible or do I have to create a rule for every bundle, every controller and every action in it?

1

1 Answers

0
votes

you can use this pattern

default:
    pattern:  /{_controller}

Then you are allowed to call you controller action directly from url like this

http://mysite.com/MyBundle:DefaultController:index