Action
Action
Abstract controller action class.
class Action extends \Hazaar\Controller\ControllerThis base controller coordinates request-driven action execution and view-oriented response handling for standard MVC workflows. It provides helpers for layout/view assignment, early hint emission, dynamic method registration, and response fallback to rendered views when action methods do not return an explicit response instance.
Properties
view
Active view or layout instance used to render the final response.
public View $viewname
Controller type identifier.
protected string $name = 'action'methods
protected array $methodsMethods
__construct
public __construct(Request $request): voidParameters
| Parameter | Type | Description |
|---|---|---|
$request | Request |
layout
Sets the layout view for the controller.
public layout(string $view, array $data): voidInitializes a new Layout instance with the specified view and optional data, and assigns it to the controller's view property.
Parameters
| Parameter | Type | Description |
|---|---|---|
$view | string | the name of the layout view to use |
$data | array | optional associative array of data to pass to the layout view |
view
Sets the view for the current controller action.
public view(string $view, array $data): voidInstantiates a new View object with the specified view name and optional data array.
Parameters
| Parameter | Type | Description |
|---|---|---|
$view | string | the name of the view to render |
$data | array | Optional associative array of data to pass to the view. Defaults to an empty array. |
sendEarlyHints
public sendEarlyHints(array $links): boolParameters
| Parameter | Type | Description |
|---|---|---|
$links | array |
registerMethod
Registers a new method with the given name and callback.
public registerMethod(string $name, callable $callback): boolParameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the method to register |
$callback | callable | the callback function to associate with the method |
runAction
public runAction(string $actionName, array $actionArgs, bool $namedActionArgs): ResponseParameters
| Parameter | Type | Description |
|---|---|---|
$actionName | string | |
$actionArgs | array | |
$namedActionArgs | bool |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000