ControllerResolver
in package
implements
ResolverInterface
Policy resolver that applies conventions based policy classes for CakePHP ORM Tables, Entities and Queries.
Table of Contents
Interfaces
- ResolverInterface
Properties
- $appNamespace : string
- Application namespace.
- $overrides : array<string, string>
- Plugin name overrides.
Methods
- __construct() : mixed
- Constructor
- getControllerClass() : Controller>|null
- Determine the controller class name based on current request and controller param
- getPolicy() : mixed
- Get a policy for an ORM Table, Entity or Query.
- findPolicy() : mixed
- Locate a policy class using conventions
- getControllerPolicy() : mixed
- Get a policy for an entity
- getControllerPolicyByName() : mixed
- Get a policy for a table
- getControllerPolicyByRequest() : mixed
- Get a the policy based on the controller
- getNamespace() : string
- Returns plugin namespace override if exists.
Properties
$appNamespace
Application namespace.
protected
string
$appNamespace
= 'App'
$overrides
Plugin name overrides.
protected
array<string, string>
$overrides
= []
Methods
__construct()
Constructor
public
__construct([string $appNamespace = 'App' ][, array<string, string> $overrides = [] ]) : mixed
Parameters
- $appNamespace : string = 'App'
-
The application namespace
- $overrides : array<string, string> = []
-
A list of plugin name overrides.
getControllerClass()
Determine the controller class name based on current request and controller param
public
getControllerClass(string $controller[, string|null $plugin = null ][, string|null $prefix = null ]) : Controller>|null
Parameters
- $controller : string
- $plugin : string|null = null
- $prefix : string|null = null
Return values
Controller>|nullgetPolicy()
Get a policy for an ORM Table, Entity or Query.
public
getPolicy(mixed $resource) : mixed
Parameters
- $resource : mixed
-
The resource.
Tags
findPolicy()
Locate a policy class using conventions
protected
findPolicy(string $class, string $name, string $namespace) : mixed
Parameters
- $class : string
-
The full class name.
- $name : string
-
The name suffix of the resource.
- $namespace : string
-
The namespace to find the policy in.
Tags
getControllerPolicy()
Get a policy for an entity
protected
getControllerPolicy(Controller $controller) : mixed
Parameters
- $controller : Controller
getControllerPolicyByName()
Get a policy for a table
protected
getControllerPolicyByName(string $controller[, string|null $plugin = null ][, string|null $prefix = null ]) : mixed
Parameters
- $controller : string
- $plugin : string|null = null
- $prefix : string|null = null
getControllerPolicyByRequest()
Get a the policy based on the controller
protected
getControllerPolicyByRequest(ServerRequest $request) : mixed
Parameters
- $request : ServerRequest
getNamespace()
Returns plugin namespace override if exists.
protected
getNamespace(string $namespace) : string
Parameters
- $namespace : string
-
The namespace to find the policy in.