PHP 클래스 RESTfulAPI_EmberDataSerializer

. JSON serialization and de-serialization
저자: Thierry Francois @colymba [email protected]
상속: extends RESTfulAPI_BasicSerializer
파일 보기 프로젝트 열기: colymba/silverstripe-restfulapi

보호된 프로퍼티들

프로퍼티 타입 설명
$sideloadedRecords array Stores the current $sideloaded_records config

공개 메소드들

메소드 설명
__construct ( ) Construct and set current config
formatName ( string $name ) : string Format a SilverStripe ClassName or Field name to be used by the client API
serialize ( DataObject | DataList $data ) : string Convert raw data (DataObject or DataList) to JSON ready to be consumed by the client API

보호된 메소드들

메소드 설명
getSideloadData ( DataObject | DataList $dataSource ) : array Fetches and return all the data that need to be sideloaded for a specific source DataObject or DataList.
hasSideloadedRecords ( string $classname ) : boolean Check if a specific class requires data to be sideloaded.
insertSideloadData ( stdClass $root, DataObject | DataList $dataSource ) : stdClass Take a root object ready to be converted into JSON and an original data source (DataObject OR DataList) and insorts into the root object all relation records that should be sideloaded.
serializeColumnName ( string $name ) : string Format a DB Column name or Field name to be used by the client API

메소드 상세

__construct() 공개 메소드

Construct and set current config
public __construct ( )

formatName() 공개 메소드

Format a SilverStripe ClassName or Field name to be used by the client API
public formatName ( string $name ) : string
$name string ClassName of DBField name
리턴 string Formatted name

getSideloadData() 보호된 메소드

Fetches and return all the data that need to be sideloaded for a specific source DataObject or DataList.
protected getSideloadData ( DataObject | DataList $dataSource ) : array
$dataSource DataObject | DataList The source data to fetch sideloaded records for
리턴 array A map of relation names with their data

hasSideloadedRecords() 보호된 메소드

Check if a specific class requires data to be sideloaded.
protected hasSideloadedRecords ( string $classname ) : boolean
$classname string Requested data classname
리턴 boolean True if some relations should be sideloaded

insertSideloadData() 보호된 메소드

Take a root object ready to be converted into JSON and an original data source (DataObject OR DataList) and insorts into the root object all relation records that should be sideloaded.
protected insertSideloadData ( stdClass $root, DataObject | DataList $dataSource ) : stdClass
$root stdClass Root object ready to become JSON
$dataSource DataObject | DataList The original data set from the root object
리턴 stdClass The updated root object sith the sideloaded data attached

serialize() 공개 메소드

Convert raw data (DataObject or DataList) to JSON ready to be consumed by the client API
public serialize ( DataObject | DataList $data ) : string
$data DataObject | DataList Data to serialize
리턴 string JSON representation of data

serializeColumnName() 보호된 메소드

Format a DB Column name or Field name to be used by the client API
protected serializeColumnName ( string $name ) : string
$name string Field name
리턴 string Formatted name

프로퍼티 상세

$sideloadedRecords 보호되어 있는 프로퍼티

Stores the current $sideloaded_records config
protected array $sideloadedRecords
리턴 array