RestReadController
extends EntityRestController
in package
Class RestReadController
Table of Contents
Constants
- HEADER_ALT_AUTHORIZATION = 'X-Auth'
- HEADER_AUTHORIZATION = 'Authorization'
- OPTION_PAGE_DESCRIPTION = 'pageDescription'
- OPTION_PAGE_TITLE = 'pageTitle'
Properties
- $activePermissionOptions : array<string|int, mixed>|string|null
- $activePermissionRole : string|null
- $authenticatedUserId : int|null
- $catchControllerOutput : bool
- Catch controller output when running it
- $entityService : EntityService
- $filterUser : AbstractUser|null
- $item : PermanentEntity|null
- $options : array<string|int, mixed>
- Running options for this controller
- $parent : PermanentEntity|null
- $pathItemId : string
- $route : ControllerRoute|null
- The route calling this controller A controller could be called without any route and any request This variable comes to get the route without any request
- $user : AbstractUser|null
- $request : InputRequest|null
- The request calling this controller
Methods
- __construct() : mixed
- Controller constructor
- __toString() : string
- Get this controller as string
- authenticateAdvancedRole() : bool
- checkRights() : array<string|int, mixed>
- fillValues() : void
- Fill array with default values
- getAuthenticatedUserId() : int|null
- getCurrentUrl() : string
- getOption() : string|mixed
- Get an option by $key
- getRequest() : InputRequest|null
- Get the request
- getRoute() : ControllerRoute|null
- Get the route
- getRouteName() : string|null
- Get the route name
- getUserAccess() : int
- Get current user access level If anonymous, the access is -1
- getValues() : array<string|int, mixed>
- Get parameter values of this controller Use it to generate routes (as for menus) with path parameters & you can get the current context
- postRun() : OutputResponse|null
- After running the controller
- prepare() : OutputResponse|null
- Prepare environment for this route
- preRun() : OutputResponse|null
- Before running controller
- preRun() : HttpResponse|null
- Before running controller
- process() : OutputResponse|null
- Process the $request
- processException() : HttpResponse
- processUserException() : mixed
- Process the given UserException
- render() : mixed
- Render the given $layout in $response using $values
- renderHtml() : HtmlHttpResponse
- Render the given $layout with $values
- renderOutput() : JsonHttpResponse
- run() : JsonHttpResponse
- Run this controller
- run() : HttpResponse
- Run this controller
- setOption() : AbstractController
- Set an option by $key
- setOptions() : AbstractController
- Set an option by $key
- redirectToSelf() : RedirectHttpResponse
Constants
HEADER_ALT_AUTHORIZATION
public
mixed
HEADER_ALT_AUTHORIZATION
= 'X-Auth'
HEADER_AUTHORIZATION
public
mixed
HEADER_AUTHORIZATION
= 'Authorization'
OPTION_PAGE_DESCRIPTION
public
mixed
OPTION_PAGE_DESCRIPTION
= 'pageDescription'
OPTION_PAGE_TITLE
public
mixed
OPTION_PAGE_TITLE
= 'pageTitle'
Properties
$activePermissionOptions
protected
array<string|int, mixed>|string|null
$activePermissionOptions
= null
$activePermissionRole
protected
string|null
$activePermissionRole
= null
$authenticatedUserId
protected
static int|null
$authenticatedUserId
= null
$catchControllerOutput
Catch controller output when running it
protected
bool
$catchControllerOutput
= false
$entityService
protected
EntityService
$entityService
$filterUser
protected
AbstractUser|null
$filterUser
= null
$item
protected
PermanentEntity|null
$item
= null
$options
Running options for this controller
protected
array<string|int, mixed>
$options
= []
$parent
protected
PermanentEntity|null
$parent
= null
$pathItemId
protected
string
$pathItemId
= 'itemId'
$route
The route calling this controller A controller could be called without any route and any request This variable comes to get the route without any request
protected
ControllerRoute|null
$route
= null
$user
protected
AbstractUser|null
$user
= null
$request
The request calling this controller
private
InputRequest|null
$request
= null
Methods
__construct()
Controller constructor
public
__construct(ControllerRoute|null $route, array<string|int, mixed> $options) : mixed
Parameters
- $route : ControllerRoute|null
- $options : array<string|int, mixed>
__toString()
Get this controller as string
public
__toString() : string
Return values
stringauthenticateAdvancedRole()
public
authenticateAdvancedRole(object $options, HttpRequest $request, string $role) : bool
Parameters
- $options : object
- $request : HttpRequest
- $role : string
Return values
boolcheckRights()
public
checkRights(ControllerRoute $route, object $options) : array<string|int, mixed>
Parameters
- $route : ControllerRoute
- $options : object
Return values
array<string|int, mixed>fillValues()
Fill array with default values
public
fillValues([array<string|int, mixed> &$values = [] ]) : void
Parameters
- $values : array<string|int, mixed> = []
getAuthenticatedUserId()
public
static getAuthenticatedUserId() : int|null
Return values
int|nullgetCurrentUrl()
public
getCurrentUrl() : string
Return values
stringgetOption()
Get an option by $key
public
getOption(string $key[, mixed|null $default = null ]) : string|mixed
Parameters
- $key : string
- $default : mixed|null = null
Return values
string|mixedgetRequest()
Get the request
public
getRequest() : InputRequest|null
Return values
InputRequest|nullgetRoute()
Get the route
public
getRoute() : ControllerRoute|null
Return values
ControllerRoute|nullgetRouteName()
Get the route name
public
getRouteName() : string|null
Return values
string|nullgetUserAccess()
Get current user access level If anonymous, the access is -1
public
getUserAccess() : int
Return values
intgetValues()
Get parameter values of this controller Use it to generate routes (as for menus) with path parameters & you can get the current context
public
getValues() : array<string|int, mixed>
Return values
array<string|int, mixed>postRun()
After running the controller
public
postRun(mixed $request, mixed $response) : OutputResponse|null
Parameters
- $request : mixed
- $response : mixed
Tags
Return values
OutputResponse|nullprepare()
Prepare environment for this route
public
prepare(mixed $request) : OutputResponse|null
Parameters
- $request : mixed
Return values
OutputResponse|nullpreRun()
Before running controller
public
preRun(mixed $request) : OutputResponse|null
Parameters
- $request : mixed
Return values
OutputResponse|nullpreRun()
Before running controller
public
preRun(mixed $request) : HttpResponse|null
Parameters
- $request : mixed
Return values
HttpResponse|nullprocess()
Process the $request
public
process() : OutputResponse|null
Tags
Return values
OutputResponse|nullprocessException()
public
processException(Exception $exception[, array<string|int, mixed> $values = [] ]) : HttpResponse
Parameters
- $exception : Exception
- $values : array<string|int, mixed> = []
Return values
HttpResponseprocessUserException()
Process the given UserException
public
processUserException(UserException $exception) : mixed
Parameters
- $exception : UserException
Tags
render()
Render the given $layout in $response using $values
public
render(OutputResponse $response, string $layout[, array<string|int, mixed> $values = [] ]) : mixed
Parameters
- $response : OutputResponse
- $layout : string
- $values : array<string|int, mixed> = []
Return values
mixed —The $response
renderHtml()
Render the given $layout with $values
public
renderHtml(string $layout[, array<string|int, mixed> $values = [] ]) : HtmlHttpResponse
Parameters
- $layout : string
- $values : array<string|int, mixed> = []
Return values
HtmlHttpResponserenderOutput()
public
renderOutput(mixed $data) : JsonHttpResponse
Parameters
- $data : mixed
Return values
JsonHttpResponserun()
Run this controller
public
run(HttpRequest $request) : JsonHttpResponse
Parameters
- $request : HttpRequest
Return values
JsonHttpResponserun()
Run this controller
public
run(mixed $request) : HttpResponse
Parameters
- $request : mixed
Return values
HttpResponsesetOption()
Set an option by $key
public
setOption(string $key, mixed $value) : AbstractController
Parameters
- $key : string
- $value : mixed
Return values
AbstractControllersetOptions()
Set an option by $key
public
setOptions(array<string|int, mixed> $options) : AbstractController
Parameters
- $options : array<string|int, mixed>
Return values
AbstractControllerredirectToSelf()
protected
redirectToSelf() : RedirectHttpResponse