code placement

I wanted a couple of opinions where code should go. I have always followed the idea of Fat models and thin controllers and I still do for the most part. But with Yii It is so easy to write 1-2 lines to pull something from the DB that I am finding more of my simpler code going intothe controller.

Where would you put this line:


$dataProvider = new ActiveDataProvider([

            'query' => Item::find()->with('state')->joinWith('token')->where(['active' => 1]),

            'pagination' => array('pageSize' => 50),

            ]);

 

My natural instinct is to call from the controller to the model a function that calls the above code and returns the data back to the controller. But this seems inefficient for the sake of 2 lines in the controller. I’d be interested to know what other peoples views on this are?

:rolleyes: