yiisoft/yii — pull request #1102 by cebe (2012-08-02 09:01:13+00:00)
Title: fixed relational beforeFind criteria modification

This is not supposed to be merged since this fix might break applications even if it is fixing a problem due to behavior change. Criteria modifications that did not apply in the past will apply now and might break.
See also here: https://github.com/yiisoft/yii/issues/93#issuecomment-7437218

It fixes the problem described in issue #93, where criteria modification done in beforeFind() did not apply when model is in a relation context and is supposed to show up how a solution would look like, we need
to think about a solution that does not break existing applications.
I am sharing this code to provide a basis for discussion about a non-breaking solution.