Closed farmani closed 11 years ago
json_encode
is actually part of the 5.3 and willing to use namespaces, didn't consider that... json_encode
is much faster. In which scenario do you think is worth using CJSON object instead? Functions?
json_encode
can handle array only and CJSON
can encode array and model objects instantiated from ActiveRecord you right json_encode is much faster and usually in api we focus on performance but as part of Yii project may be someone like to use builtin Yii ORM.
changing json_encode
come to my mind when I want to use YiiSolr but after your idea about the performance I think why should I use YiiSolr when I import data via Data Import Handler and so I remove YiiSolr extnesion and use PECL Solr extension without any yii wrapper now I use json_encode
too but I still think that CJSON can handle model object and array together and which one should be used by default?
I used to have CJSON before... It won't be to hard to go back and implement that feature... Having thought deeper, is true, for EApiController maybe is a better approach...
in EApiController json_encode is used to implement encoding array to json format but because this is a yii framework boilerplate why you are not using CJSON can handle model object as simple as array?