PHP Class Controller_Data_RESTful, atk4

RESTful access is typically implemented through two URL patterns: Collection URI such as: 'resources.json', listing and adding new records. Element URI such as: 'resources/28.json', updating and deleting existing records. You must define both properties in your model: public $collection_uri = 'resources.json'; public $element_uri = 'resources/{$id}.json'; This Data Controller uses Pest as transport: https://github.com/educoder/pest If you use XML API, change $transport_class to 'PestXML';
Inheritance: extends Controller_Data
Show file Open project: atk4/atk4

Public Properties

Property Type Description
$transport_class

Protected Properties

Property Type Description
$insert_mode
$update_mode PestJSON | PestXML

Public Methods

Method Description
delete ( $model, $id )
loadById ( $model, $id ) Implement loadBy
loadCurrent ( $model, &$cursor )
prefetchAll ( $model ) Implement iteration
save ( $model, $id, $data ) Saving, updating and deleting data
sendCollectionRequest ( $model, $method = 'GET', $data = null )
sendItemRequest ( $model, $id, $method = 'GET', $data = null )
sendRawRequest ( $model, $url, $method = 'GET', $data = null ) Sends request to specified URL with specified method and data.
setSource ( $model, $table )

Method Details

delete() public method

public delete ( $model, $id )

loadById() public method

Implement loadBy
public loadById ( $model, $id )

loadCurrent() public method

public loadCurrent ( $model, &$cursor )

prefetchAll() public method

Implement iteration
public prefetchAll ( $model )

save() public method

Saving, updating and deleting data
public save ( $model, $id, $data )

sendCollectionRequest() public method

public sendCollectionRequest ( $model, $method = 'GET', $data = null )

sendItemRequest() public method

public sendItemRequest ( $model, $id, $method = 'GET', $data = null )

sendRawRequest() public method

Sends request to specified URL with specified method and data.
public sendRawRequest ( $model, $url, $method = 'GET', $data = null )

setSource() public method

public setSource ( $model, $table )

Property Details

$insert_mode protected property

protected $insert_mode

$transport_class public property

public $transport_class

$update_mode protected property

PestJSON | PestXML
protected $update_mode