symfony-cmf / symfony-cmf-docs

The documentation for the symfony content management framework
http://cmf.symfony.com
44 stars 157 forks source link

Update routing.rst #717

Closed mediamonks-robert closed 9 years ago

mediamonks-robert commented 9 years ago

Action is automatically added. When specifing the action as "indexAction" in the config it will actually convert to "indexActionAction' function which does not exist resulting in a "Controller "::indexAction" for URI "/" is not callable." exception.

mediamonks-robert commented 9 years ago

Can also be applied to 1.0/1.1/1.2 branches if possible or do you want me to create new PRs for that?

dbu commented 9 years ago

Action is only appended when you use the class notation App:Default:index for AppBundle\Controller\DefaultController::indexAction, not when you use the service notation controller.default:indexAction. the examples you try to change are with services, so they are correct. if this is the first example of routing configuration in the book, we could add a note to tell the readers we use services for route definitions, and if you use the other notation, things look different. and link to the symfony doc about routing configuration.

mediamonks-robert commented 9 years ago

Makes sense, thanks for explaining! I'd go with your suggestion to explain this example assumes your controllers are defined as services then.

dbu commented 9 years ago

thanks, appreciate the input. anything that makes live easier for first time readers is a good improvement. can you do a new pull request against the 1.2 branch? we merge 1.2 to master regularly. the older versions are not actively maintained anymore.

mediamonks-robert commented 9 years ago

I'll try to create a new PR within a few days but I'm not sure if I can explain it well enough yet.

dbu commented 9 years ago

just try it, we can help if its not clear enough, no worries. the idea would be a very short note saying we do the controllers as services and link to this cookbook article: http://symfony.com/doc/current/cookbook/controller/service.html