PHP Класс RESTfulAPI_DefaultQueryHandler

..
Автор: Thierry Francois @colymba [email protected]
Наследование: implements RESTfulAPI_QueryHandler
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$deSerializer RESTfulAPI_DeSerializer Current deSerializer instance
$requestedData array Stores the currently requested data

Открытые методы

Метод Описание
createModel ( string $model, SS_HTTPRequest $request ) : DataObject Create object of class $model
deleteModel ( string $model, integer $id, SS_HTTPRequest $request ) : null | array Delete object of Class $model and ID $id
findModel ( string $model, boolean | integr $id = false, array $queryParams, SS_HTTPRequest $request ) : DataObject | DataList Finds 1 or more objects of class $model
getdeSerializer ( ) : RESTfulAPI_DeSerializer Return current RESTfulAPI DeSerializer instance
handleQuery ( SS_HTTPRequest $request ) : DataObjec | DataList All requests pass through here and are redirected depending on HTTP verb and params
parseQueryParameters ( array $params ) : array Parse the query parameters to appropriate Column, Value, Search Filter Modifiers array( array( 'Column' => ColumnName, 'Value' => ColumnValue, 'Modifier' => ModifierType ) )
updateModel ( String | DataObject $model, integer $id, $request ) : DataObject Update databse record or $model

Описание методов

createModel() публичный Метод

Create object of class $model
public createModel ( string $model, SS_HTTPRequest $request ) : DataObject
$model string
$request SS_HTTPRequest
Результат DataObject

deleteModel() публичный Метод

Delete object of Class $model and ID $id
public deleteModel ( string $model, integer $id, SS_HTTPRequest $request ) : null | array
$model string Model class
$id integer Model ID
$request SS_HTTPRequest Model ID
Результат null | array NULL if successful or array with error detail

findModel() публичный Метод

Handles column modifiers: :StartsWith, :EndsWith, :PartialMatch, :GreaterThan, :LessThan, :Negation and query modifiers: sort, rand, limit
public findModel ( string $model, boolean | integr $id = false, array $queryParams, SS_HTTPRequest $request ) : DataObject | DataList
$model string Model(s) class to find
$id boolean | integr The ID of the model to find or false
$queryParams array Query parameters and modifiers
$request SS_HTTPRequest The original HTTP request
Результат DataObject | DataList Result of the search (note: DataList can be empty)

getdeSerializer() публичный Метод

Return current RESTfulAPI DeSerializer instance
public getdeSerializer ( ) : RESTfulAPI_DeSerializer
Результат RESTfulAPI_DeSerializer DeSerializer instance

handleQuery() публичный Метод

All requests pass through here and are redirected depending on HTTP verb and params
public handleQuery ( SS_HTTPRequest $request ) : DataObjec | DataList
$request SS_HTTPRequest HTTP request
Результат DataObjec | DataList DataObject/DataList result or stdClass on error

parseQueryParameters() публичный Метод

Parse the query parameters to appropriate Column, Value, Search Filter Modifiers array( array( 'Column' => ColumnName, 'Value' => ColumnValue, 'Modifier' => ModifierType ) )
public parseQueryParameters ( array $params ) : array
$params array raw GET vars array
Результат array formatted query parameters

updateModel() публичный Метод

Update databse record or $model
public updateModel ( String | DataObject $model, integer $id, $request ) : DataObject
$model String | DataObject the model or class to update
$id integer The ID of the model to update
Результат DataObject The updated model

Описание свойств

$deSerializer публичное свойство

Current deSerializer instance
public RESTfulAPI_DeSerializer $deSerializer
Результат RESTfulAPI_DeSerializer

$requestedData публичное свойство

Stores the currently requested data
public array $requestedData
Результат array