ControllerInterface
What the framework asks of a controller: resolve and build the action and view for a dispatch, answer questions about what a module contains, and hold the response being assembled.
Narrower than Controller: startup(), shutdown(), reset() and initialize() drive the controller’s own lifecycle and belong to the context that owns it, not to the middleware and services that dispatch through it.
Synopsis
Section titled “Synopsis”interface ControllerInterface
| Implemented by | Controller |
| Since | 3.2.0 |
| Source | Controller/ControllerInterface.php |
Methods
Section titled “Methods”actionExists()
Section titled “actionExists()”abstract public function actionExists(string $moduleName, string $actionName): bool
Whether an action exists in a module.
| Parameter | Type | Description |
|---|---|---|
$moduleName | string | |
$actionName | string |
Returns bool
createActionInstance()
Section titled “createActionInstance()”abstract public function createActionInstance(string $moduleName, string $actionName): Action
Build (and initialize) an action instance for a module.
| Parameter | Type | Description |
|---|---|---|
$moduleName | string | |
$actionName | string |
Returns Action
createViewInstance()
Section titled “createViewInstance()”abstract public function createViewInstance(string $moduleName, string $viewName): View
Build a view instance for a module.
| Parameter | Type | Description |
|---|---|---|
$moduleName | string | |
$viewName | string |
Returns View
getContext()
Section titled “getContext()”abstract public function getContext(): Context
The context this controller belongs to.
Returns Context
getGlobalResponse()
Section titled “getGlobalResponse()”abstract public function getGlobalResponse(): WebResponse
The response being assembled for this request.
Returns WebResponse
getOutputType()
Section titled “getOutputType()”abstract public function getOutputType(?string $name = null): OutputType
A configured output type by name, or the default when $name is null.
| Parameter | Type | Description |
|---|---|---|
$name | ?``string |
Returns OutputType
getOutputTypeNames()
Section titled “getOutputTypeNames()”abstract public function getOutputTypeNames(): array<int, string>
The names of every configured output type.
Returns array``<``int``, ``string``>
initializeModule()
Section titled “initializeModule()”abstract public function initializeModule(string $moduleName): mixed
Load a module’s autoload and configuration, once per process.
| Parameter | Type | Description |
|---|---|---|
$moduleName | string |
Returns mixed
| Throws | When |
|---|---|
DisabledModuleException | If the module is disabled. |
modelExists()
Section titled “modelExists()”abstract public function modelExists(string $moduleName, string $modelName): bool
Whether a model exists in a module.
| Parameter | Type | Description |
|---|---|---|
$moduleName | string | |
$modelName | string |
Returns bool
moduleExists()
Section titled “moduleExists()”abstract public function moduleExists(string $moduleName): bool
Whether a module exists.
| Parameter | Type | Description |
|---|---|---|
$moduleName | string |
Returns bool
viewExists()
Section titled “viewExists()”abstract public function viewExists(string $moduleName, string $viewName): bool
Whether a view exists in a module.
| Parameter | Type | Description |
|---|---|---|
$moduleName | string | |
$viewName | string |
Returns bool