I was wondering if it would make sense to define the $_model variable already in the class CModel instead of CActiveRecord. Also the function model could be defined in CModel (slightly different from the version in AR):
public static function model($className=CLASS)
{
if(isset(self::$_models[$className]))
return self::$_models[$className];
else
{
$model=self::$_models[$className]=new $className(null);
$model->attachbehaviors($model->behaviors());
return $model;
}
}
This way one could also get the static model of a class extending CFormModel.