Greetings,

I've gotta admit that I've struggled for a bit with routing on ZF2. After a lot of reading (a particular eye-opener was this comment from Matthew[1]) and head-scratching, I'd like you guys to validate the concept I came up with:

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.

This leads to another point: Although is theoretically possible to emulate ZF1-style routing (by crafting a very ugly and over-complicated segment route), it would be generally a bad idea, since this would lead to a segment route containing :controller, :action, :key, :value, thus allowing any controller in the application to receive data, which would result in performance and maybe security issues.

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).

Is my line of thinking correct?

TIA,

--
Er Galvão Abbott

[1] http://framework.zend.com/manual/2.2/en/user-guide/routing-and-controllers.html#comment-706138835

--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to