Action
Action
Abstract controller action class.
class Action extends \Hazaar\ControllerExtends: Hazaar\Controller
This 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 $viewType: Hazaar\View
name
Controller type identifier.
protected string $name = 'action'Type: string
methods
protected array $methodsType: array
Methods
__construct
public __construct(Request $request): voidParameters
| Parameter | Type | Description |
|---|---|---|
$request | Hazaar\Application\Request |
layout
Sets the layout view for the controller.
public layout(string $view, array $data): voidReturns: void
Initializes 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): voidReturns: void
Instantiates 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): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$links | array |
registerMethod
Registers a new method with the given name and callback.
public registerMethod(string $name, callable $callback): boolReturns: bool
Parameters
| 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): ResponseReturns: Hazaar\Controller\Response
Parameters
| Parameter | Type | Description |
|---|---|---|
$actionName | string | |
$actionArgs | array | |
$namedActionArgs | bool |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000