Class ActiveRecordWrapper
You want to send your CActiveRecord implementation to a json response? Use this class.
// Get a model $model = MyModel::model()->findByPk(1); // Wrap your model $wrapper = new ActiveRecordWrapper($model); // Get a JsonResponse instance $response = container('response')->produce('json'); // Set response body $response->setBody($wrapper); // Send response to client $response->send(); // To send your json request in a short way, you can use `response()` function response('json', 200, $wrapper)->send();
- Docolight\Support\ActiveRecordWrapper implements Docolight\Http\Contracts\Arrayable
Namespace: Docolight\Support
Author: Krisan Alfa Timur krisanalfa@docotel.co.id
Located at Docolight/Support/ActiveRecordWrapper.php
Author: Krisan Alfa Timur krisanalfa@docotel.co.id
Located at Docolight/Support/ActiveRecordWrapper.php
Methods summary
public
|
|
public static
|
|
public
array
|
|
public
|
|
protected
|