Documentation

Restapi_Command_Controller extends Core_Command_Controller
in package

REST API command controller.

Tags
subpackage

Restapi

version
7.x
author

Hostmake LLC

copyright

© 2005-2024 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru

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

$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()

$_mode

Request mode, e.g. JSON, XML

protected string|null $_mode = \NULL

$_statusCode

HTTP code, default 200

protected int $_statusCode = 200

Methods

__construct()

Constructor.

public __construct() : mixed

showAction()

Default controller action

public showAction() : Core_Response
Tags
hostcms-event

Restapi_Command_Controller.onBeforeShowAction

hostcms-event

Restapi_Command_Controller.onAfterShowAction

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

Tags
hostcms-event

Restapi_Command_Controller.onBeforeAddNewEntity

hostcms-event

Restapi_Command_Controller.onBeforeUpdateEntity


        
On this page

Search results