Thanks for the great feedback!

I already converted many of my methods to actions helpers or moved them to
controller plugins.

When I was exploring documentation and code I had a following idea:

In Zend_Controller_Action there is __call method:
public function __call($methodName, $args)
    {
        require_once 'Zend/Controller/Action/Exception.php';
        if ('Action' == substr($methodName, -6)) {
            $action = substr($methodName, 0, strlen($methodName) - 6);
            throw new Zend_Controller_Action_Exception(sprintf('Action "%s"
does not exist and was not trapped in __call()', $action), 404);
        }

        throw new Zend_Controller_Action_Exception(sprintf('Method "%s" does
not exist and was not trapped in __call()', $methodName), 500);
    }


Could it have updated so, it checks action helpers also? Something like
this:

public function __call($methodName, $args)
    {
        require_once 'Zend/Controller/Action/Exception.php';
        if ('Action' == substr($methodName, -6)) {
            $action = substr($methodName, 0, strlen($methodName) - 6);
            throw new Zend_Controller_Action_Exception(sprintf('Action "%s"
does not exist and was not trapped in __call()', $action), 404);
        }
                else {
                        try {
                                return 
call_user_func_array(array($this->_helper, $methodName), $args);
                        } catch (Zend_Controller_Action_Exception $e) {
                        }
                }

        throw new Zend_Controller_Action_Exception(sprintf('Method "%s" does
not exist and was not trapped in __call()', $methodName), 500);
    }


When I use action helpers in the code, lines look like this:
$this->_helper->somehelper($arg1); // goes to helper's direct() method
with this __call update this could be shorter:
$this->somehelper($arg1);

I already tried it and it worked. But are there any other things to be
considered?


br, Marko
-- 
View this message in context: 
http://www.nabble.com/Base-Controller-convienience-methods-tp22036897p22080392.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to