PHP Class RESTfulAPI_BasicDeSerializer

. JSON serialization and de-serialization
Author: Thierry Francois @colymba [email protected]
Inheritance: implements RESTfulAPI_DeSerializer
Show file Open project: colymba/silverstripe-restfulapi

Public Methods

Method Description
deserialize ( $json ) : array | false Convert client JSON data to an array of data ready to be consumed by SilverStripe
unformatName ( string $name ) : string Format a ClassName or Field name sent by client API to be used by SilverStripe

Protected Methods

Method Description
unformatPayloadData ( array $data ) : array Process payload data from client and unformats columns/values recursively

Private Methods

Method Description
deserializeColumnName ( string $name ) : string Format a DB Column name or Field name sent from client API to be used by SilverStripe

Method Details

deserialize() public method

Expects payload to be formatted: { "FieldName": "Field value", "Relations": [1] }
public deserialize ( $json ) : array | false
return array | false Formatted array representation of the JSON data or false if failed

unformatName() public method

Format a ClassName or Field name sent by client API to be used by SilverStripe
public unformatName ( string $name ) : string
$name string ClassName of Field name
return string Formatted name

unformatPayloadData() protected method

Process payload data from client and unformats columns/values recursively
protected unformatPayloadData ( array $data ) : array
$data array Payload data (decoded JSON)
return array Paylaod data with all keys/values unformatted