I have a trouble with software design. I want to design a relation between Controller, Component, View and Helper. Ihave these models Aricle, Product, List . And in contents of Article and Product there are lists tags in form of [LIST=1].

So I'd like to render these lists and inject them into content in place of tags. I thought that good idea would be a ListRendererHelper which would render lists inside of View like this $this->ListRenderer->renderList($listId). And it would be a good idea if I list ids in database, but I should obtain it from content. And this is not good practice to manipulate with objects inside of View nor insert a lot of PHP code in View.

So I think that best place to manipulate content is Controller, and here obtain the lists ids. But I shouldn't use Helper in Controller so I think that I should make a Component for Controller. And here is my problem, because I will have to write render code twice in Component and in Helper which is against DRY. Other solution is to call Helper inside Component but that would be a MVC break too. So anyone have an idea how to design it?

Related posts

Recent Viewed