Issues

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

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.

Assigning to Ben to resolve once router refactoring is merged to master.

The new router was merged a while back, and this functionality is included there.