shajal_8015
(Shajal Chandra Bala)
1
Dear All,
Hope everyone is fine. I have a question about MVC Framework like Yii or something like that. My question is
Where should be put SQL query Model OR Controller and why ? what is advantages ? like some example…
Your opinion is very important.
Thanks
sajal
softark
(Softark)
3
Definitely.
Please take a look at this section of the guide. 
http://www.yiiframework.com/doc/guide/1.1/en/basics.best-practices
konapaz
(Konapaz)
4
Hi my friend
In addition notify that even the sql must definitely reside in model,
you can pass parameters from controller to method of the model for more flexibility
There are special cases (rarely) that you could use it directly in controller
see an example
http://www.yiiframework.com/doc/api/1.1/CSqlDataProvider
but only if you do not use the same sql pattern more than one time in your application