Hi Jeff,
I always add methods that will only be used by that controller (eg. a shared save method for add/edit actions, or a form building method) to the controller directly, I don't see that as polluting the controller in any way. The reason all action methods have to be suffixed with Action is so that they wont conflict with other methods. I only use helpers for things that are generic and may be used by multiple controllers.

Jeffrey Sambells wrote:
Hi All,

Just wondering about controller action helpers and methods on controllers. If an app has a custom controller class extended from Zend_Controller_Action, is there a preferred way of adding "helper" methods? For example, I could add a method directly to the class or add a helper via an action helper class. Obviously there would be a different syntax:

$this->_helper->foo( 'bar' );

vs.

$this->foo( 'bar' );

but is there any other advantages or disadvantages? I keep thinking that I should write action helpers so I don't "pollute" the controller but then it's more annoying to type _helper all the time.

Thanks,

Jeff

--
Jack

Reply via email to