Issues

ZF2-40: Short class name for route type

Issue Type: Improvement Created: 2011-07-20T16:23:16.000+0000 Last Updated: 2012-02-23T16:39:05.000+0000 Status: Closed Fix version(s): Reporter: Artur Bodera (joust) Assignee: Ben Scholzen (dasprid) Tags: - Zend\Mvc\Router

  • configuration
  • routing

Related issues: Attachments:

Description

This is the current way of configuring a single route:

<pre class="highlight">
'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:

<pre class="highlight">
'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.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts