yiisoft/yii — Issue #392: inconsistent code CActiveRecord
Author: cebe
Created: 2012-02-23 22:32:03+00:00
State: open

Long time ago (I was using Yii 1.1.4) I had some problems with an AR behavior that was not able to adjust the owner ARs criteria in onBeforeFind event.

A quick fix to the first problem reported as [issue 1740](http://code.google.com/p/yii/issues/detail?id=1740) has been added by @qiangxue in [r2639](http://code.google.com/p/yii/source/detail?r=2639).

After some time @samdark removed a part of that code without a comment in [r2969](http://code.google.com/p/yii/source/detail?r=2969) which was reported in [issue 2732](http://code.google.com/p/yii/issues/detail?id=2732). (btw: I am that cbrandt@metadesign.de)

The situation now is:
CModelEvent still holds the [$criteria property](https://github.com/yiisoft/yii/blob/master/framework/base/CModelEvent.php#L32) that is never used except in [line 955 in CActiveRecord](https://github.com/yiisoft/yii/blob/master/framework/db/ar/CActiveRecord.php#L955). CActiveRecords beforeFind() is never called with that parameter as of the change mentioned above and though these parts of code are orphans that cannot be used and should be

* either removed, if @samdark's solution in [issue 2732](http://code.google.com/p/yii/issues/detail?id=2732#c2) works (didn't check that due to lack of time yet)
* or fixed if it is still not possible to adjust criteria in beforeFind in a behavior.

#93 might also be related to this, will check the details on this next month.