symfony - Convention-based routing in Symfony2 -


i'm trying learn learn how routing works in symfony2, , far i've read has examples this:

blog:     path:      /blog/{page}     defaults:  { _controller: acmeblogbundle:blog:index, page: 1 } 

this routes requests /blog/123 acmeblogbundle blog controller's "index" action, , passes 123 parameter "page" parameter controller action. if no page parameter passed, page defaults 1.

that's , good, if want have convention based routing system passes things through this:

/{bundle}/{controller}/{action} 

so, url this:

/acme/blog/index 

it call acmeblogbundle blog controller's "index" action.

no specific routing configuration necessary, infers bundle, controller, , action url. can continue adding bundles, controllers, , actions, , don't need modify routing configuration. works.

if isn't possible, can @ least infer controller , action url? e.g., perhaps need route identifies bundle, can controller , action url?

i read through symfony "the book" page routing, , couldn't figure out way this.

no way. considered bad practice , removed symfony.

but should take @ @route annotation, simplifies configuring routes in such nice way. directly attached action, there no lack between config , code.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -