ZF2-40: Short class name for route type
Description
This is the current way of configuring a single route:
'foo' => array(
'route' => 'foo',
'type' => 'Zend\Controller\Router\Route\StaticRoute',
'defaults' => array(
'action' => 'index',
),
),
Because 99% of people will only use the basic route types (Static, Regex, Hostname, etc.) there is no need to enforce supplying the whole class name. As 2.0 is 5.3+, then we already have namespaces for that and we can educate people to use short class names.
My suggestion is to allow this:
'foo' => array(
'route' => 'foo',
'type' => 'StaticRoute', // class name in Zend\Controller\Router\Route namespace
'defaults' => array(
'action' => 'index',
),
),
Comments
Posted by Artur Bodera (joust) on 2011-07-20T19:23:47.000+0000
Fixed. Waiting for pull https://github.com/zendframework/zf2/pull/251
Posted by Matthew Weier O'Phinney (matthew) on 2011-07-25T21:06:56.000+0000
Patch looks good. However, the router is being rewritten currently (see https://github.com/DASPRiD/zf2/tree/router-rewrite); and the current implementation (SimpleRouteStack) already provides broker capabilities that implement the feature you're requesting (short-name mappings). We can resolve this issue once that work is merged to master.
Posted by Matthew Weier O'Phinney (matthew) on 2011-07-25T21:07:40.000+0000
Assigning to Ben to resolve once router refactoring is merged to master.
Posted by Adam Lundrigan (adamlundrigan) on 2012-02-23T16:39:05.000+0000
The new router was merged a while back, and this functionality is included there.