Won't work if you have a different URI design. I.e. we use http:// example.org/index.php/contact.add.import instead of http:// example.org/index.php/contact/add/import or http://example.org/ index.php/contact_add/import or ... as controller (+ module) name.

If the default Action class is changed to have the same parameters in _redirect() as in _forward(), it won't be easy to change that in your own class extending the Action class. But it's easy to create an Action class, that has the same parameters with the current Action class:

class Example_Controller_Action {
function _redirect($action, $controller = null, $module = null, array $options = null) {
                        if ($controller === null) {
                                $controller = 
$this->getRequest()->getControllerName();
                        }
                        $url = $controller . '/' . $action;
                        if ($module !== null) {
                                $url = $module . '/' . $url;
                        }
                        parent::_redirect($url, $options);
        }
}

nico

[03.04.2007 08:39] Stephan Stapel wrote:

Hi!

I asked myself why _forward() and _redirect() haven't the same footprint. As they are relatives without doubt, this would make the interface more
consistent.
Why not simply make the function look like this:

_redirect($action, $controller = null, $module = null, $params = null); ?

I guess this would make it even easier to distinguish both functions as - from the viewpoint of a developer - there must be a reason that a class
comes with two different functions with identical parameters...

cheers,

Stephan


Reply via email to