One ActiveRecord class => multiple tables / Model "Factory" / Model cach...

Extend CActiveRecord::model to return model instances that do not correspond to real classes, but to dynamically created models.
This allows a single class to be used to refer to different tables and still use features that rely on 'CActiveRecord::model($classname)'.

Currently a CActiveRecord::model($classname) corresponds to 1 table using a real class "$classname".

Some features like the CActiveGridView will use CActiveRecord::model to get new data from the table.

CActiveRecord::model($className) already behaves like a factory/object cache - it looks up the $className in its internal list $_models. However, it can only return instances for real classes (i.e., $className must correspond to a class), and hence 1 model instance <=> 1 table <=> 1 class. The changes allow n model instances <=> n tables <=> 1 class.