Model -> View or Model -> Controller -> View

Hi all,

I’m still wondering if I should query my model directly from the view, for example with


<?php echo User::model()->active()->count(); ?>

or if I should have my controller do it and then just pass the variable from the controller into my view.

I know that Yii queries the model directly at least when working with forms.

But does that work when I at some point decide to use unit tests?

How are you all handling this?

Regards

ycast

Better would be to pass data from controller to view instead of querying it in view but this gives overhead which not everyone can accept :)