LFT
  • Namespace
  • Class
  • Tree

Namespaces

  • Docoflow
    • Contracts
    • Entity
    • Facades
    • Models
    • Traits
  • Docolight
    • Agno
      • Traits
    • Container
    • Http
      • Contracts
    • Rest
      • Handler
      • Http
    • Support
      • Debug
      • Traits
  • Docotory
    • Traits
  • None

Classes

  • ActiveRecordWrapper
  • Arr
  • Carbonate
  • ClassLoader
  • Collection
  • CollectionDataProvider
  • Facade
  • Factory
  • Fluent
  • Html
  • IterablePager
  • Repository
  • Set
  • Str

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

Methods summary

public
# __construct( CActiveRecord $model )

Initialize the class.

Initialize the class.

Parameters

$model
$default Default attribute inside this class
public static
# make( CActiveRecord $model )

Initialize the class statically.

Initialize the class statically.

Parameters

$model
$default Default attribute inside this class
public array
# castToArray( )

Convert implementation to an array.

Convert implementation to an array.

Returns

array

Implementation of

Docolight\Http\Contracts\Arrayable::castToArray()
public
# fill( mixed $model )

Bulk insert attributes.

Bulk insert attributes.

Parameters

$model
$attributes

Implementation of

Docolight\Http\Contracts\Arrayable::fill()
protected
# innerFill( CActiveRecord $model )

Inner fill to maintain type hint.

Inner fill to maintain type hint.

Parameters

$model

Properties summary

protected CActiveRecord $model

Our model implementation

Our model implementation

#
LFT API documentation generated by ApiGen