\RESTfulAPI_BasicSerializer
Basic RESTfulAPI Model Serializer handles DataObject, DataList etc.. JSON serialization and de-serialization
- Author: Thierry Francois @colymba thierry@colymba.com
- Copyright: Copyright (c) 2013, Thierry Francois
- License: http://opensource.org/licenses/BSD-3-Clause BSD Simplified
Synopsis
class RESTfulAPI_BasicSerializer
implements
RESTfulAPI_Serializer
{
- // members
- private string $contentType = 'application/json; charset=utf-8';
- protected $embeddedRecords;
- // methods
- public string getcontentType()
- public void __construct()
- protected string jsonify()
- public string serialize()
- protected array|null formatDataObject()
- protected array formatDataList()
- public string formatName()
- protected string serializeColumnName()
- protected array|null getEmbedData()
- protected boolean isEmbeddable()
Hierarchy
Implements
Members
private
- $contentType
—
string
Content-type header definition for this Serializer Used by RESTfulAPI in the response
protected
- $embeddedRecords
—
array
Stores the current $embedded_records @config Config set on {@link RESTfulAPI}
Methods
protected
- formatDataList() — Format a DataList into a formatted array ready to be turned into JSON
- formatDataObject() — Format a DataObject keys and values ready to be turned into JSON
- getEmbedData() — Returns a DataObject relation's data formatted and ready to embed.
- isEmbeddable() — Checks if a speicific model's relation should have its records embedded.
- jsonify() — Convert data into a JSON string
- serializeColumnName() — Format a DB Column name or Field name to be used by the client API
public
- __construct() — Construct and set current config
- formatName() — Format a SilverStripe ClassName or Field name to be used by the client API
- getcontentType() — Return Content-type header definition to be used in the API response
- serialize() — Convert raw data (DataObject or DataList) to JSON ready to be consumed by the client API