galvao wrote > 1) Routing should be as specific as possible when dealing with > controllers. In other words it would probably be a bad idea to map a > segment route using /[:controller], since the controller shouldn't be > specified directly in the URL.
It's not really about NOT specifying the controller in the URL. It's more about separating the two concerns altogether. The route is there to tell the developer, "hey, go to this URL (/some/foo) using this VERB (GET, POST) with some request parameters (param=value) - and you can expect the application to do this". Once they hit that route, it's up to the underlying application how it intends to handle that request (using whatever controller/action combination). I guess a comparison could be a function name and its parameters. You could define a function like this: request($method, $params); And then you can very carefully document all the values $method can accept, and then based on that what values $params can accept. Or, you could do something like this: requestSomethingSpecific($params); requestSomethingEvenMoreSpecific(); It's just more explicit and readily clear what each function does. And it's easier to document the $params individually for each function. Of course, most of the time we'll have conventions to dictate how our functions should be named and will usually follow the same format (requestControllerAction(...)). galvao wrote > 2) Assuming the above point is correct, this basically means that, if > you have a web application on which every controller should be invokable > by HTTP request, you'll have as many routes on your module.config.php > file as the number of controllers in your application (which I don't > consider a bad thing, just to be clear). Correct. Each module will have its own route, those will have child routes - one for each controller in that module. In turn those routes will have their own child routes - one for each action in that controller. This is just the general case though and depending on how you organize your application you might find you'll have fewer or more routes. Another benefit of an explicitly named route is they're much easier to call from a redirect() or url() plugin/helper. The route name is kind of self documenting and you don't have to figure out/duplicate the controller/action/parameter each time. Hope this helps and others will chime in if I misspoke on anything. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Please-validate-my-understanding-of-routing-tp4661386p4661390.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com