Design question: DB operations in widget?

I have another design question.

Using Prado, if I built a page out of many small components, each component could encapsulate its own interactions with the underlying database.

If I was to build a controller action to pass all of the required data to the view, I would be passing the result of 8 or 9 disparate database operations to the render method. Is it bad practice to put db operations in a widget? Should they all be in the controller?

I'm still trying to wrap my head around the essence of MVC in Yii. I've been thinking about things in an ASP.NET/Prado way for too long!

Yes, once nice thing about prado is each component is self contained. Yii tries to achieve the similar thing. A widget is like a prado control, or a sub-controller, which has its own view (in widget view) and logic (in widget class), and may have some models.

So yes, you can put db operations in a widget, as long as the widget is self contained. For example, take a look at the Guide and API's comment feature on this site. They are achieved using two widgets: one responsible for collecting user input and one for displaying comments.

Thanks heaps, Qiang. This is exactly the quality of answer I was looking for.

Good to see the comment feature back, too.