PHP Interface RESTfulAPI_Serializer

Author: Thierry Francois @colymba [email protected]
Show file Open project: colymba/silverstripe-restfulapi Interface Usage Examples

Public Methods

Method Description
formatName ( string $name ) : string Format a SilverStripe ClassName of DBField to be used by the client API
getcontentType ( ) : string Return Content-type header definition to be used in the API response
serialize ( DataObject | DataList | Array $data ) : string Convert raw data (DataObject, DataList or Array) to JSON ready to be consumed by the client API

Method Details

formatName() public method

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

getcontentType() public method

Return Content-type header definition to be used in the API response
public getcontentType ( ) : string
return string Content-type

serialize() public method

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