JSON based applicaton. how to replace AR in model?

JSON/Array to "model" problem.

I’m working on an application which only deal with API(JSON data). no local database. I want to know if there are anyway to process JSON/Array data in “model”? It seems AR is meaningless for this. But how to keep using the lovely “$model->Products” and “attributeLabels”…?

Currently i only get/process the JSON data in controller and assign to “view”. it’s not using the yii power at all. and it’s not MVC.

I search yii forum. and only found the following post. but it’s not a complete solution.


I’m a newbie. It’s appricated if anyone can give me some hints or sample codes. Thanks.

I don’t know how to solve your particular problem, but for the AR question, your model does not have to inherit from the ActiveRecord class, and instead can extend the CFormModel class:


I’m guessing you could define your getter/setter methods in there based on the JSON model you’re working with…