-- mvanlamz <[email protected]> wrote (on Friday, 13 February 2009, 07:44 AM -0800): > > While _redirect() and _forward() are protected, you'll find that > gotoUrlAndExit() and a bunch of others are public, and can be called from > your action helper. > > (For the record, I vote for making _redirect() and _forward() public too. > Why not? Until I noticed some of the public methods, I was about to > implement my own method to do a redirect, and if I have to implement my own > methods, then why am I using the Zend library?)
This has been noted for 2.0 already, actually, and we'll likely start the process of deprecating the protected methods sooner. > Matthew Weier O'Phinney-3 wrote: > > > > -- Ralf Kramer <[email protected]> wrote > > (on Wednesday, 24 October 2007, 02:10 AM +0200): > >> Am Montag, den 22.10.2007, 04:14 -0400 schrieb Matthew Weier O'Phinney: > >> > it's because _forward() is a protected method in > >> > Zend_Controller_Action; you can't call it from a public instance of the > >> > object. > >> > >> There are certainly good reasons to make _forward final and protected > >> and _redirect protected. Thus, I decided to create my own class > >> Quasda_Controller_Action_Helper_Abstract extends > >> Zend_Controller_Action_Helper_Abstract > >> { > >> > >> which implements _forward and _redirect and acts a base class for all my > >> future action helpers. The implementation of these methods is in case of > >> _forward identically to the implementation in Zend_Controller_Action and > >> in case of _redirect I needed to use > >> Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector'); > >> to gain access to the redirector. > >> > >> This works fine so far, what only bothers me, is that I have doubled > >> code in my application. A violation to the DRY convention. Isn't it a > >> desirable target to have access to regular "Action" methods in "Action" > >> helpers? > > > > I'd have to agree with you here, actually. I inherited the MVC a little > > over a year ago, and _forward() and _redirect() were already protected. > > My feeling is that they should likely be public, and I may make that > > change for a future release (having _forward() and _redirect() proxy to > > them while throwing a warning indicating deprecation). > > > > -- > > Matthew Weier O'Phinney > > PHP Developer | [email protected] > > Zend - The PHP Company | http://www.zend.com/ > > > > > > -- > View this message in context: > http://www.nabble.com/Writing-ActionHelper%3A-Undefined-property%3A-%24_actionController-tp13334895p21998875.html > Sent from the Zend Framework mailing list archive at Nabble.com. > -- Matthew Weier O'Phinney Software Architect | [email protected] Zend Framework | http://framework.zend.com/
