AhgController
extends AhgControllerBase
in package
Standalone base controller for AHG plugins.
Dual-stack compatible:
- Through Symfony (index.php): extends sfActions via AhgControllerBase, inherits isSecure(), initialize(), getCredential(), etc.
- Through Laravel (heratio.php): standalone with adapter-based helpers.
Plugin action classes use: class myActions extends AhgController
The property-assignment pattern ($this->varName = value) works in both modes. New helpers: config(), culture(), userId(), boot(), renderJson(), renderBlade().
Table of Contents
Properties
- $csrf_token : string
- CSRF token for use in templates (set during enforceCsrf).
Methods
- __construct() : mixed
- __get() : mixed
- __isset() : bool
- __set() : void
- boot() : void
- Boot hook — runs before execute{Action}().
- dispatch() : Response
- Dispatch to the appropriate execute{Action}() method.
- forward() : void
- forward404() : void
- getActionName() : string
- getContext() : SfContextAdapter|null
- getModuleName() : string
- getRequest() : SfWebRequestAdapter|null
- getResponse() : SfResponseAdapter
- getRoute() : mixed
- Get the matched route object (Symfony compatibility).
- getTemplateVars() : array<string|int, mixed>
- Get all stored template variables.
- getUser() : SfUserAdapter
- redirect() : void
- renderText() : mixed
- Render raw text content — works in both Symfony and standalone mode.
- setTemplate() : void
Properties
$csrf_token
CSRF token for use in templates (set during enforceCsrf).
public
string
$csrf_token
= ''
Methods
__construct()
public
__construct() : mixed
__get()
public
__get(string $name) : mixed
Parameters
- $name : string
__isset()
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool__set()
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
boot()
Boot hook — runs before execute{Action}().
public
boot() : void
Override this instead of preExecute(). No need to call parent. loadHelpers() calls are unnecessary — Blade handles i18n and URLs.
dispatch()
Dispatch to the appropriate execute{Action}() method.
public
dispatch(string $action, mixed $request[, string $module = '' ]) : Response
Called by ActionBridge in standalone mode. Handles the full lifecycle: boot() → execute{Action}() → template rendering → Response.
Parameters
- $action : string
- $request : mixed
- $module : string = ''
Return values
Responseforward()
public
forward(string $module, string $action) : void
Parameters
- $module : string
- $action : string
forward404()
public
forward404([string|null $message = null ]) : void
Parameters
- $message : string|null = null
getActionName()
public
getActionName() : string
Return values
stringgetContext()
public
getContext() : SfContextAdapter|null
Return values
SfContextAdapter|nullgetModuleName()
public
getModuleName() : string
Return values
stringgetRequest()
public
getRequest() : SfWebRequestAdapter|null
Return values
SfWebRequestAdapter|nullgetResponse()
public
getResponse() : SfResponseAdapter
Return values
SfResponseAdaptergetRoute()
Get the matched route object (Symfony compatibility).
public
getRoute() : mixed
In Symfony mode, sfActions::getRoute() returns the matched QubitRoute with a ->resource property. In standalone mode, the ActionBridge stores the route as a request attribute.
getTemplateVars()
Get all stored template variables.
public
getTemplateVars() : array<string|int, mixed>
In Symfony mode, reads from sfActions' varHolder. In standalone mode, reads from templateVars array.
Return values
array<string|int, mixed>getUser()
public
getUser() : SfUserAdapter
Return values
SfUserAdapterredirect()
public
redirect(mixed $url) : void
Parameters
- $url : mixed
renderText()
Render raw text content — works in both Symfony and standalone mode.
public
renderText(mixed $text) : mixed
In Symfony mode: delegates to sfActions::renderText() which returns sfView::NONE. In standalone mode: sets explicit Response object.
Parameters
- $text : mixed
setTemplate()
public
setTemplate(string $name) : void
Parameters
- $name : string