init() - original question was to change DB connection before find - it can be done here
In Yii 1.1, in cases as your I used scopes (defaultScope as well), in Yii2 scopes present. Define defaultScope for a model with same query as you did in beforeFind and it will be applied every time you call ActiveRecord. Read more here.
For the "afterFind()" method is a bad implementation, because this is executed after query executed and all model loaded.
For overwrite a new ActiveQuery for a default Scope, already will be added complex knowledge like someone that will not ever use "where()" method or for a "Scope", to not use before any "where()" condition, like:
is really differente like:
Where this last one will override the "active()" scope and will added another complexity to not ever call before a "where()" condition.
To set a default query we will need to make a lot of things, like a new ActiveQuery implementation or a base ActiveRecord that call another Base ActiveQuery to overwrite "createCommand()" and add a "beforeFind()" method to force the query to be added e etc. There are a lot of definitions can be added but none is a good thing.
For all this, wont be a good implementation that can be easy done by framework.
Now, the question is, what is better to do? Default Scope and never use method "where()" (complexity), add a Scope to be used but not use before a "where()" method (added complexity)? Create a new ActiveQuery to be used for all models and change the behavior that was did by framework?
When you think just with a developer, is easy. Just tell "use Scope and andWhere() condition", forget "where()" unless you need this.
But when you are in a company that has more than 5 developer and this system can has more than that at a time, we’ll just say “dont use where() just andWhere() conditions” or always look for his codes to avoid this human error.
Resuming all, I think with the behaviors of Yii2 framework today we cant do what we want better.
The init() is called as a constructor class but only for a respective class without overwrite constructor, right? so, beforeFind() is just called before make query… If in Yii2 create a beforeQuery() method or something like this, will perfect make sense and resolve a lot of problems like ours ones.
We are thinkin to override all Models and ActiveQuery to just to put "beforeCommand()" or a "beforeQuery()" in a "createCommand()" method of db classes, this method will can puts any query before get the results.