Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
RestResourceController Class Reference

Abstract base class for Rest controllers associated with a specific resource (model). More...

+ Inheritance diagram for RestResourceController:

Public Member Functions

 initialize ()
 Method called before each action Can be override in derived class.
 
- Public Member Functions inherited from RestBaseController
 __construct ()
 Constructor initialize $view variable.
 
 index ()
 Default action.
 
 isValid ($action)
 Returns True if access to the controller is allowed To be override in sub classes.
 
 onInvalidControl ()
 Called if isValid () returns false To be override in sub classes.
 
 connect ()
 Realize the connection to the server.
 
 finalize ()
 Method called after each action Can be override in derived class.
 
 _errorHandler ($e)
 
 _setResponseCode ($value)
 
 _get ($condition='1=1', $include=false, $useCache=false)
 Returns a list of objects from the server.
 
 _getAll ()
 Returns all the instances from the model $resource.
 
 _getOne ($keyValues, $include=false, $useCache=false)
 Get the first object corresponding to the $keyValues.
 
 _format ($arrayMessage)
 
 _getManyToOne ($ids, $member, $include=false, $useCache=false)
 
 _getOneToMany ($ids, $member, $include=false, $useCache=false)
 
 _getManyToMany ($ids, $member, $include=false, $useCache=false)
 
 _update (... $keyValues)
 Update an instance of $model selected by the primary key $keyValues Require members values in $_POST array.
 
 _add ()
 Insert a new instance of $model Require members values in $_POST array.
 
 _getRelationShip ($id, $member)
 Returns an associated member value(s).
 
 _delete (... $keyValues)
 Delete the instance of $model selected by the primary key $keyValues.
 
- Public Member Functions inherited from Controller
 loadView (string $viewName, $pData=null, bool $asString=false)
 Loads the view $viewName possibly passing the variables $pdata.
 
 loadDefaultView ($pData=null, bool $asString=false)
 Loads the default view (controllerName/actionName) possibly passing the variables $pdata.
 
 getDefaultViewName ()
 Returns the default view name for this controller/action i.e ControllerName/actionName.html for the action actionName in ControllerName If there is an activeTheme @activeTheme/ControllerName/actionName.html
 
 forward (string $controller, string $action='index', $params=[], bool $initialize=false, bool $finalize=false)
 Loads the controller $controller and calls its $action method by passing the parameters $params.
 
 redirectToRoute (string $routeName, $parameters=[], bool $initialize=false, bool $finalize=false)
 Redirect to a route by its name.
 
 getView ()
 Returns the associated view instance.
 
- Public Member Functions inherited from RestControllerUtilitiesTrait
 _validateInstance ($instance, $members, $excludedValidators=[])
 

Static Public Member Functions

static _getTemplateFile ()
 Returns the template for creating this type of controller.
 
- Static Public Member Functions inherited from RestBaseController
static _getApiVersion ()
 

Additional Inherited Members

- Protected Member Functions inherited from RestBaseController
 checkPermissions ($action, $datas=null)
 To override in derived classes.
 
 requireAuth ($action)
 Returns true if $action require an authentification with token.
 
 refreshToken ()
 Refresh an active token.
 
- Protected Member Functions inherited from RestControllerUtilitiesTrait
 getDatas ()
 
 getRequestParam ($param, $default)
 
 operate_ ($instance, $callback, $status, $exceptionMessage, $keyValues)
 
 generatePagination (&$filter, $pageNumber, $pageSize)
 
 updateOperation ($instance, $datas, $updateMany=false)
 
 addOperation ($instance, $datas, $insertMany=false)
 
 _getResponseFormatter ()
 
 getResponseFormatter ()
 To override, returns the active formatter for the response.
 
 _getRequestFormatter ()
 
 getRequestFormatter ()
 To override, returns the active formatter for the request.
 
 _getRestServer ()
 
 getRestServer ()
 To override, returns the active RestServer.
 
 _setValuesToObject ($instance, $values=[])
 Updates $instance with $values To eventually be redefined in derived classes.
 
 updateManyToOne ($manyToOneRelations, $members, $className, $instance, $values)
 
 getInclude ($include)
 
 addError ($code, $title, $detail=null, $source=null, $status=null)
 
 hasErrors ()
 
 displayErrors ()
 
 getAssociatedMemberValues_ ($ids, $getDatas, $member, $include=false, $useCache=false, $multiple=true)
 
 addViolation (ConstraintViolation $violation)
 
 getPrimaryKeysFromDatas ($datas, $model)
 
 getCondition ($condition)
 
- Protected Attributes inherited from RestBaseController
 $config
 
 $model
 
 $contentType
 
 $restCache
 
 $useValidation = true
 
 $responseFormatter
 
 $requestFormatter
 
 $server
 
- Protected Attributes inherited from Controller
View $view
 
- Protected Attributes inherited from RestControllerUtilitiesTrait
 $errors
 

Detailed Description

Abstract base class for Rest controllers associated with a specific resource (model).

Ubiquity\controllers\rest$RestController This class is part of Ubiquity

Author
jcheron myadd.nosp@m.ress.nosp@m.mail@.nosp@m.gmai.nosp@m.l.com
Version
1.0.5

Definition at line 20 of file RestResourceController.php.

Member Function Documentation

◆ _getTemplateFile()

static _getTemplateFile ( )
static

Returns the template for creating this type of controller.

Returns
string

Reimplemented from RestBaseController.

Definition at line 38 of file RestResourceController.php.

◆ initialize()

initialize ( )

Method called before each action Can be override in derived class.

Reimplemented from RestBaseController.

Definition at line 22 of file RestResourceController.php.


The documentation for this class was generated from the following file: