Issues

ZF-2390: Easier overloading for Zend_Controller_Dispatcher_Standard

Issue Type: Improvement Created: 2008-01-07T10:11:03.000+0000 Last Updated: 2008-03-21T16:25:22.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Lars Strojny (lars) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Controller

Related issues: Attachments: - 001-easy-dispatcher-overloading.diff

Description

This patch enables easier overloading for Zend_Controller_Dispatcher_Standard. It helps someone to implement an extended dispatcher which simply changes the way the class formatting is done.

Comments

Posted by Lars Strojny (lars) on 2008-01-07T10:12:25.000+0000

Add Zend_Controller_Dispatcher_Standard::formatClassName() to allow easy overloading of the class formatting facility.

Posted by Matthew Weier O'Phinney (matthew) on 2008-01-29T12:35:47.000+0000

Can you provide the use case (code) that would require this change (or that this change would facilitate)?

Posted by Lars Strojny (lars) on 2008-01-29T18:55:04.000+0000

There are two use cases:

Using a different separator:

<pre class="highlight">
class MyDispatcher extends Zend_Controller_Dispatcher
{
    public function formatClassName($module, $class)
    {
        return $this->formatModuleName($module) . '::' . $class;
    }

    public function classToFilename($class)
    {
        return str_replace('::', DIRECTORY_SEPARATOR, $class) . '.php';
    }
}

Having a default prefix:

<pre class="highlight">
class MyDispatcher extends Zend_Controller_Dispatcher
{
    protected $_prefix;

    public function setPrefix($prefix)
    {
        $this->_prefix;
        return $this;
    }

    public function getPrefix()
    {
         return $this->_prefix;
    }

    public function formatClassName($module, $class)
    {
        return $this->getPrefix() . '::' . $this->formatModuleName($module) . '::' . $class;
    }

    public function classToFilename($class)
    {
        return str_replace('::', DIRECTORY_SEPARATOR, $class) . '.php';
    }
}

Posted by Matthew Weier O'Phinney (matthew) on 2008-02-14T11:34:18.000+0000

Scheduling for 1.5.0

Posted by Matthew Weier O'Phinney (matthew) on 2008-02-20T21:51:53.000+0000

Applied in trunk; thanks for the patch!

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