AhgActions
extends sfActions
in package
Base action class for AHG plugins.
Extends sfActions with automatic framework bootstrap and modern helpers. Plugin action classes should extend this instead of sfActions directly.
Usage: class myActions extends AhgActions { public function executeIndex(sfWebRequest $request) { // Framework is already bootstrapped — no need for AhgDb::init() $culture = $this->culture(); $userId = $this->userId(); } }
Table of Contents
Methods
- __get() : mixed
- __isset() : mixed
- __set() : mixed
- __unset() : mixed
- execute() : string
- Override execute() to auto-detect blade templates.
- forward() : mixed
- Forward to another action.
- forward404() : mixed
- Forward to a 404 error page.
- forward404If() : mixed
- Forward to 404 if condition is true.
- forward404Unless() : mixed
- Forward to 404 unless condition is true.
- generateUrl() : string
- Generate a URL.
- getActionName() : string
- getContext() : sfContext
- getController() : sfController
- getCredential() : mixed
- Get the credential required for this action.
- getDefaultView() : string
- Get default view — returned when execute returns sfView::INPUT.
- getLayout() : string|false|null
- Get the layout.
- getModuleName() : string
- getPartial() : string
- Get a partial template as a string.
- getRequest() : sfWebRequest
- getRequestParameter() : mixed
- getResponse() : sfWebResponse
- getRoute() : sfRoute|null
- Get the matched route object.
- getSecurityConfiguration() : array<string|int, mixed>
- Get the full security configuration.
- getTemplate() : string|null
- Get the template for this action.
- getUser() : sfUser
- getVar() : mixed
- getVarHolder() : sfParameterHolder
- handleError() : string
- Handle validation error — called when validate() returns false.
- hasRequestParameter() : bool
- hasVar() : bool
- Check if a template variable exists.
- initialize() : mixed
- Initialize the component.
- isSecure() : bool
- Check if the action is secure.
- logMessage() : mixed
- Log a message via event dispatcher.
- postExecute() : mixed
- preExecute() : mixed
- Auto-bootstrap the framework before every action.
- redirect() : mixed
- Redirect to a URL.
- redirectToRoute() : mixed
- Redirect to a route.
- renderPartial() : mixed
- Include a partial template.
- renderText() : string
- Render inline text (returns sfView::NONE).
- setLayout() : mixed
- Set the layout.
- setSecurityConfiguration() : mixed
- Set the security configuration.
- setTemplate() : mixed
- Set the template for this action.
- setVar() : mixed
- setViewClass() : mixed
- Set the view class for this action.
- validate() : bool
- Validate the request — returns true by default.
Methods
__get()
public
& __get(mixed $name) : mixed
Parameters
- $name : mixed
__isset()
public
__isset(mixed $name) : mixed
Parameters
- $name : mixed
__set()
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
__unset()
public
__unset(mixed $name) : mixed
Parameters
- $name : mixed
execute()
Override execute() to auto-detect blade templates.
public
execute(mixed $request) : string
After the action method runs, if it returned null (meaning "render the default success template"), we check if a .blade.php version exists. If so, render via BladeRenderer and return sfView::NONE to skip the PHP template.
Parameters
- $request : mixed
Return values
string —View name
forward()
Forward to another action.
public
forward(string $module, string $action) : mixed
Parameters
- $module : string
- $action : string
Tags
forward404()
Forward to a 404 error page.
public
forward404([string $message = null ]) : mixed
Parameters
- $message : string = null
Tags
forward404If()
Forward to 404 if condition is true.
public
forward404If(bool $condition[, string $message = null ]) : mixed
Parameters
- $condition : bool
- $message : string = null
forward404Unless()
Forward to 404 unless condition is true.
public
forward404Unless(bool $condition[, string $message = null ]) : mixed
Parameters
- $condition : bool
- $message : string = null
generateUrl()
Generate a URL.
public
generateUrl(string $route[, array<string|int, mixed> $params = [] ][, bool $absolute = false ]) : string
Parameters
- $route : string
-
Route name or module/action
- $params : array<string|int, mixed> = []
-
Parameters
- $absolute : bool = false
-
Generate absolute URL
Return values
stringgetActionName()
public
getActionName() : string
Return values
stringgetContext()
public
getContext() : sfContext
Return values
sfContextgetController()
public
getController() : sfController
Return values
sfControllergetCredential()
Get the credential required for this action.
public
getCredential() : mixed
getDefaultView()
Get default view — returned when execute returns sfView::INPUT.
public
getDefaultView() : string
Return values
stringgetLayout()
Get the layout.
public
getLayout() : string|false|null
Return values
string|false|nullgetModuleName()
public
getModuleName() : string
Return values
stringgetPartial()
Get a partial template as a string.
public
getPartial(string $templateName[, array<string|int, mixed> $vars = [] ]) : string
Parameters
- $templateName : string
-
module/partial or just partial
- $vars : array<string|int, mixed> = []
Return values
stringgetRequest()
public
getRequest() : sfWebRequest
Return values
sfWebRequestgetRequestParameter()
public
getRequestParameter(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
- $default : mixed = null
getResponse()
public
getResponse() : sfWebResponse
Return values
sfWebResponsegetRoute()
Get the matched route object.
public
getRoute() : sfRoute|null
Return values
sfRoute|nullgetSecurityConfiguration()
Get the full security configuration.
public
getSecurityConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed>getTemplate()
Get the template for this action.
public
getTemplate() : string|null
Return values
string|nullgetUser()
public
getUser() : sfUser
Return values
sfUsergetVar()
public
getVar(string $name) : mixed
Parameters
- $name : string
getVarHolder()
public
getVarHolder() : sfParameterHolder
Return values
sfParameterHolderhandleError()
Handle validation error — called when validate() returns false.
public
handleError() : string
Return values
string —sfView constant
hasRequestParameter()
public
hasRequestParameter(string $name) : bool
Parameters
- $name : string
Return values
boolhasVar()
Check if a template variable exists.
public
hasVar(string $name) : bool
Parameters
- $name : string
Return values
boolinitialize()
Initialize the component.
public
initialize(sfContext $context, string $moduleName, string $actionName) : mixed
Parameters
- $context : sfContext
- $moduleName : string
- $actionName : string
isSecure()
Check if the action is secure.
public
isSecure() : bool
Return values
boollogMessage()
Log a message via event dispatcher.
public
logMessage(string $message[, string $priority = 'info' ]) : mixed
Parameters
- $message : string
- $priority : string = 'info'
-
'info', 'warning', 'error', etc.
postExecute()
public
postExecute() : mixed
preExecute()
Auto-bootstrap the framework before every action.
public
preExecute() : mixed
redirect()
Redirect to a URL.
public
redirect(string $url[, int $statusCode = 302 ]) : mixed
Parameters
- $url : string
- $statusCode : int = 302
Tags
redirectToRoute()
Redirect to a route.
public
redirectToRoute(string $route[, array<string|int, mixed> $params = [] ][, int $statusCode = 302 ]) : mixed
Parameters
- $route : string
- $params : array<string|int, mixed> = []
- $statusCode : int = 302
renderPartial()
Include a partial template.
public
renderPartial(mixed $templateName[, mixed $vars = [] ]) : mixed
Parameters
- $templateName : mixed
- $vars : mixed = []
renderText()
Render inline text (returns sfView::NONE).
public
renderText(string $text) : string
Parameters
- $text : string
Return values
string —sfView::NONE
setLayout()
Set the layout.
public
setLayout(string|false $name) : mixed
Parameters
- $name : string|false
-
Layout name or false to disable
setSecurityConfiguration()
Set the security configuration.
public
setSecurityConfiguration(array<string|int, mixed> $security) : mixed
Parameters
- $security : array<string|int, mixed>
setTemplate()
Set the template for this action.
public
setTemplate(string $name[, string $module = null ]) : mixed
Parameters
- $name : string
-
Template name (without suffix)
- $module : string = null
-
Module name (current module if null)
setVar()
public
setVar(string $name, mixed $value[, bool $safe = false ]) : mixed
Parameters
- $name : string
- $value : mixed
- $safe : bool = false
-
Mark value as safe for output escaping
setViewClass()
Set the view class for this action.
public
setViewClass(string $module, string $action, string $class) : mixed
Parameters
- $module : string
- $action : string
- $class : string
validate()
Validate the request — returns true by default.
public
validate() : bool