Restapi_Command_Controller
extends Core_Command_Controller
in package
REST API command controller.
Tags
Table of Contents
Properties
- $path : string
- Request path
- $version : string
- Selected API version
- $_answer : mixed
- REST API answer
- $_availableOperators : array<string|int, mixed>
- Available operators in the filter fields ne - "!=" not equal to lt - "<" is less than gt - ">" is greater than lte - "≤" is less than or equal to gte - "≥" is greater than or equal to
- $_config : array<string|int, mixed>
- Module Config
- $_error : string|null
- Error Message
- $_expand : array<string|int, mixed>
- GET expand
- $_limit : int
- GET limit
- $_mode : string|null
- Request mode, e.g. JSON, XML
- $_oCore_Response : Core_Response|null
- Core_Response
- $_offset : int
- GET offset
- $_statusCode : int
- HTTP code, default 200
- $_uri : string|null
- URI
- $_user : User_Model|null
Methods
- __construct() : mixed
- Constructor.
- getUri() : Core_Command_Controller
- Get URI
- setUri() : Core_Command_Controller
- Set URI
- showAction() : Core_Response
- Default controller action
- _applyFilterConditionsV1() : self
- Apply Filter Conditions to the $oEntity, v. 1.x
- _applyOrderByV1() : self
- Apply Order By to the $oEntity, v. 1.x
- _checkAuthorization() : mixed
- Chech Authorization
- _checkContentType() : bool
- Сheck Content Type by $_SERVER['CONTENT_TYPE']
- _entity2array() : array<string|int, mixed>
- Convert $entity to array
- _entity2XML() : string|null
- Convert $entity to XML
- _getClassName() : string|false
- Get class name by $pluralName
- _getRequestHeaders() : array<string|int, mixed>
- Get Request Headers. Use apache_request_headers() or $_SERVER
- _parseByPathV1() : array<string|int, mixed>|bool
- Parse $aPath
- _selectByPathV10() : mixed
- Parse path. Version 1.0 (limit, offset, orderBy)
- _selectByPathV11() : mixed
- Parse path. Version 1.1 ($limit, $offset, $orderBy, $count)
- _version1() : mixed
- Verson 1.x
Properties
$path
Request path
public
string
$path
= \NULL
$version
Selected API version
public
string
$version
= \NULL
$_answer
REST API answer
protected
mixed
$_answer
= \NULL
$_availableOperators
Available operators in the filter fields ne - "!=" not equal to lt - "<" is less than gt - ">" is greater than lte - "≤" is less than or equal to gte - "≥" is greater than or equal to
protected
array<string|int, mixed>
$_availableOperators
= array('ne', 'lt', 'gt', 'lte', 'gte')
$_config
Module Config
protected
array<string|int, mixed>
$_config
= array()
$_error
Error Message
protected
string|null
$_error
= \NULL
$_expand
GET expand
protected
array<string|int, mixed>
$_expand
= array()
$_limit
GET limit
protected
int
$_limit
= 25
$_mode
Request mode, e.g. JSON, XML
protected
string|null
$_mode
= \NULL
$_oCore_Response
Core_Response
protected
Core_Response|null
$_oCore_Response
= \NULL
$_offset
GET offset
protected
int
$_offset
= 0
$_statusCode
HTTP code, default 200
protected
int
$_statusCode
= 200
$_uri
URI
protected
string|null
$_uri
= \NULL
$_user
protected
User_Model|null
$_user
= \NULL
Methods
__construct()
Constructor.
public
__construct() : mixed
getUri()
Get URI
public
getUri() : Core_Command_Controller
Return values
Core_Command_ControllersetUri()
Set URI
public
setUri(string $uri) : Core_Command_Controller
Parameters
- $uri : string
-
URI
Return values
Core_Command_ControllershowAction()
Default controller action
public
showAction() : Core_Response
Tags
Return values
Core_Response_applyFilterConditionsV1()
Apply Filter Conditions to the $oEntity, v. 1.x
protected
_applyFilterConditionsV1(array<string|int, mixed> $aPredefinedFields, Core_Entity $oEntity) : self
Parameters
- $aPredefinedFields : array<string|int, mixed>
- $oEntity : Core_Entity
Return values
self_applyOrderByV1()
Apply Order By to the $oEntity, v. 1.x
protected
_applyOrderByV1(array<string|int, mixed> $OrderBy, Core_Entity $oEntity) : self
Parameters
- $OrderBy : array<string|int, mixed>
- $oEntity : Core_Entity
Return values
self_checkAuthorization()
Chech Authorization
protected
_checkAuthorization() : mixed
_checkContentType()
Сheck Content Type by $_SERVER['CONTENT_TYPE']
protected
_checkContentType() : bool
Return values
bool_entity2array()
Convert $entity to array
protected
_entity2array(mixed $entity[, mixed $expand = array() ]) : array<string|int, mixed>
Parameters
- $entity : mixed
- $expand : mixed = array()
Return values
array<string|int, mixed>_entity2XML()
Convert $entity to XML
protected
_entity2XML(mixed $entity) : string|null
Parameters
- $entity : mixed
Return values
string|null_getClassName()
Get class name by $pluralName
protected
_getClassName(string $pluralName) : string|false
Parameters
- $pluralName : string
Return values
string|false_getRequestHeaders()
Get Request Headers. Use apache_request_headers() or $_SERVER
protected
_getRequestHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>_parseByPathV1()
Parse $aPath
protected
_parseByPathV1(array<string|int, mixed> $aPath) : array<string|int, mixed>|bool
Parameters
- $aPath : array<string|int, mixed>
Return values
array<string|int, mixed>|bool_selectByPathV10()
Parse path. Version 1.0 (limit, offset, orderBy)
protected
_selectByPathV10(array<string|int, mixed> $aPath) : mixed
Parameters
- $aPath : array<string|int, mixed>
_selectByPathV11()
Parse path. Version 1.1 ($limit, $offset, $orderBy, $count)
protected
_selectByPathV11(array<string|int, mixed> $aPath) : mixed
Parameters
- $aPath : array<string|int, mixed>
_version1()
Verson 1.x
protected
_version1(int $minorVersion) : mixed
Parameters
- $minorVersion : int
-
minor version, e.g. 2 for 1.2