-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Or, as actions are suffixed with Action, helpers could thus be suffixed with Helper. So you could access the URL-Helper like this:
$this->urlHelper(...); Just random thoughts. ................................... : ___ _ ___ ___ ___ _ ___ : : | \ /_\ / __| _ \ _ (_) \ : : | |) / _ \\__ \ _/ / | |) | : : |___/_/:\_\___/_| |_|_\_|___/ : :........:........................: : Web : http://www.dasprids.de : : E-mail : [email protected] : : Jabber : [email protected] : : ICQ : 105677955 : :........:........................: Marko Korhonen schrieb: > 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkmcJRgACgkQ0HfT5Ws789CSyQCgtLrdPUfrTBF8lqX1uBpCxOrK WwcAnRlm4O9j1Ml9bOum1XVWWrEcIzHt =KS67 -----END PGP SIGNATURE-----
