generic REST handler baseclass this needs to be extended by every REST handler in the application

package midcom.baseclasses

 Methods

_handler_process (mixed $handler_id, array $args, array $data)

the base handler that should be pointed to by the routes

Parameters

$handler_id

mixedThe ID of the handler.

$args

arrayThe argument list.

$data

array&$data The local request data.

_on_initialize ()

inheritDoc

bind_data ()

binds the request data to the object

get_object_classname ()

handle_create ()

handle_delete ()

handle_get ()

handle_update ()

persist_object ()

writes the changes to the dba object to the db

retrieve_object ()

retrieve the object based on classname and request parameters if we got an id, it will try to find an existing one, otherwhise it will create a new one

Returns

\midcom_baseclasses_core_dbobject

_init ()

on init start processing the request data

_process_request ()

do the processing: will call the corresponding handler method and set the mode

_send_response (string $message)

sends the response as json containing the current response data

Parameters

$message

string

_stop (string $message, int $statuscode)

stops the application and outputs the info message with corresponding statuscode

Parameters

$message

string

$statuscode

int

_check_object ()

helper function for checking if an object has been retrieved before using a function that needs one

_parse_value (string $value)

helper function for parsing the request parameters

Parameters

$value

string

Returns

string

 Properties

 

string $_mode

the request mode (get, create, update, delete)
 

\midcom_baseclasses_core_dbobject $_object

the object we're working on
 

array $_request

storing request data
 

array $_response

storing response data
 

int $_responseStatus

the response status