A yii dataprovider that extends CActiveDataProvider in order to retrieve json. Attributes and relations that are fetched are recursively configurable. Furthermore key names can be replaced by aliases to compress the json size.
Feel free to contribute at GitHub.
Update on 06/11/2013 ¶
- Extracting the work horse that does the converting to new class ModelToArrayConverter. This class is usable stand-alone, too.
- New method getArrayCountData on JSonActiveDataProvider to retrieve just the count information, but no data.
- New callback onAfterModelToArray on JSonActiveDataProvider for optional custom extracting of data per model.
- For convenience relations can be defined now directly with an attributes description (instead of wrapping them into another array with a key "attributes")
- Examples at github readme updated
All changes do not break old behavior or usage!
Developed with Yii 1.10, but should work in older versions, too.