Where do you keep big queries?

Hi, there are many big queries in the project. I want to keep these queries separate each other because they belong to many models and sometimes they don’t use any of them (only query builder or plain-text queries with bindings).

May be you know appropriate way to keep that kind queries in an application?

P.S. Now I keep it in separate classes with static methods for each query but I don’t like this solution.

P.S.S. I used to write programs on the Django framework. There are two places to keep queries in it:

  1. Models - we can use additional methods in models. The best practice is do it only for instance-based queries which change only instance itself.

  2. Model Managers - it should be use for the more complex queries for collections of model-instances.

Is there something similar in the Yii2? Or may be there is a best practice how to do it in big projects?

I think that big query should be written with SQL View and then handled by specific model.

So they are more portable.