My experience with AR so far is that it’s great for simple one-table problem, fine for simple multi-table work but gets difficult to use in some multi-table scenarios, possibly not the most common ones, but one’s I’ve had to deal with.
Discussing it with other, more experienced Yii users I found several who concede there is a degree of impedance mismatch between SQL and PHP’s notion of objects.
It struck me that key concepts of AR and maybe much of its API might be applicable to a NoSQL data store such as Couch, for example. Who knows, AR’s object modeling approach might work even better that with SQL.
Have any attempts been made in this direction? Or is the idea just daft?
An example for AR and NoSQL is the extension yiimongodbsuite.
It can save a lot of work when you need a UI for CRUD operations.
It’s nearly the same if there is a SQL or NoSQL DB behind, but with one important difference:
When using NoSQL you don’t have to maintain your db structure by db-update/alter scripts.
You don’t have to take care about existing fields and fieldtypes in your db.
You create your data structure only with PHP-code (by adding attributes to your model).
For me AR is ok, when working with single records (update, insert …).
But if you work with a lot of records (statistics, logs …) you should not use AR, because of the overhead.
And when working with AR and NoSQL you always have to generate a model with attributes/rules …
Sometimes it is easier and much better performance if you only save/load arrays to the NoSQL DB without using AR.