MVC : calling helper class from Controller instead of via Model - bad practice?
In my Controller I have a line like this:
$this->set('uid', Project::returnProjectUid($queryString));
Is this bad practice? Should I ALWAYS pass it to the Model which then calls this helper class or thi开发者_StackOverflow中文版s an acceptable practice?
Thanks.
In my point of view, any data shouldbe allways treated by the Model, no matter how simple is the call or the logic of that data management.
MVC is a pattern that helps you to keep good maintainability of your software, no matter the complexity of it. When you break the pattern in a simple part of your code, you cannot expect all your code is in that pattern, so any needed change will result in code study to be sure that part is in MVC or had the pattern broked.
Hope my English is understandable.
Regards.
精彩评论