If the duplication is isolated to that particular controller only, why
not just simply create a "no action" method to be called in those two
actions... the controller is still just a regular class.

m.

On Sat, Oct 30, 2010 at 12:41 AM, Hector Virgen <djvir...@gmail.com> wrote:
> You can probably place that common code in your preDispatch() hook:
>
> if ($article = $this->_request->getParam('article')) {
>    // Load article and assign to view
> }
>
> --
> *Hector Virgen*
> Sr. Web Developer
> http://www.virgentech.com
>
>
>
> On Fri, Oct 29, 2010 at 3:32 PM, debussy007 <debussy...@gmail.com> wrote:
>
>>
>> Hi,
>>
>> That's a recurring problem I have had for a long time :
>>
>> Let's say I have an action allowing to view an article, and an action
>> allowing to edit an article.
>>
>> To setup the views, the code is the same for both actions (get the article
>> id from GET parameter, fetch article, execute some checks, and other
>> things). Only the view files are different, in the edit version, there is a
>> form with input elements.
>>
>> I have here duplicated code. How would you handle this ?
>>
>> Thank you for any advice
>> --
>> View this message in context:
>> http://zend-framework-community.634137.n4.nabble.com/MVC-design-question-tp3019840p3019840.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>

Reply via email to