AR ViewModel

I’m working on an application right now, where I have created a view to run a grouping query (that will be used for various reports) across multiple tables.

To remove the need for a SQL-layer view (which may occur out of necessity), it would be great to see an extension to CActiveRecord, that provides a read-only model, which will query against the results of the "view" query.

In other words, for every AR request, the model’s “view” query would be executed to bring back it’s normal range of results, and those results would be queried against by AR (in the course of it’s normal functionality).

For DBMSes that support subqueries, then the "view" query could be a subquery table that is queried against. Otherwise, the data manipulation would fall back to PHP.

This idea probably has no value for most, and may even be completely needless, but I just decided to toss it out there before I forgot it :wink: If someone else wants to run with this, go for it.

Cheers