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.
http://www.yiiframew...__fromsearch__1
I'm a newbie. It's appricated if anyone can give me some hints or sample codes. Thanks.
Page 1 of 1
JSON based applicaton. how to replace AR in model?
#2
Posted 11 August 2010 - 08:34 PM
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:
http://www.yiiframew.../api/CFormModel
I'm guessing you could define your getter/setter methods in there based on the JSON model you're working with...
http://www.yiiframew.../api/CFormModel
I'm guessing you could define your getter/setter methods in there based on the JSON model you're working with...
Share this topic:
Page 1 of 1

Help











