symfony API

sfAction Class

« Back to API menu

action

addon

cache

config

controller

countable

database

debug

exception

filter

generator

helper

i18n

log

request

response

storage

test

user

util

validator

view

You are currently browsing the symfony documentation for the 1.0 version. Switch to:

sfAction executes all the logic for the current request.

Inheritence

sfActions  <  sfAction  <  sfComponent

Method Summary

forward404Unless($condition, $message = &apos;&apos;) Forwards current action to the default 404 error action unless the specified condition is true.
setLayout($name) Sets an alternate layout for this sfAction.
mixed getCredential() Gets credentials the user must have to access this action.
postExecute() Execute an application defined process immediately after execution of this sfAction object.
bool isSecure() Indicates that this action requires security.
string getSecurityConfiguration() Returns the security configuration for this module.
setViewClass($class) Changes the default view class used for rendering the template associated with the current action.
sfView::NONE renderText($text) Appends the given text to the response content and bypasses the built-in view system.
string getTemplate() Gets the name of the alternate template for this sfAction.
bool initialize((sfContext) $context) Initializes this action.
forward404($message = &apos;&apos;) Forwards current action to the default 404 error action.
redirectUnless($condition, $url) Redirects current request to a new URL, unless specified condition is true.
preExecute() Executes an application defined process prior to execution of this sfAction object.
forward($module, $action) Forwards current action to a new one (without browser redirection).
redirect404() Redirects current action to the default 404 error action (with browser redirection).
bool validate() Validates manually files and parameters.
setTemplate($name) Sets an alternate template for this sfAction.
redirect($url, $statusCode = 302) Redirects current request to a new URL.
mixed getLayout() Gets the name of the alternate layout for this sfAction.
forward404If($condition, $message = &apos;&apos;) Forwards current action to the default 404 error action if the specified condition is true.
redirectIf($condition, $url) Redirects current request to a new URL, only if specified condition is true.
forwardUnless($condition, $module, $action) Unless the condition is true, forwards current action to a new one (without browser redirection).
int getRequestMethods() Retrieves the request methods on which this action will process validation and execution.
string getDefaultView() Retrieves the default view to be executed when a given request is not served by this action.
string handleError() Executes any post-validation error application logic.
forwardIf($condition, $module, $action) If the condition is true, forwards current action to a new one (without browser redirection).
setSecurityConfiguration($security) Overrides the current security configuration for this module.

Methods inherited from sfComponent

__unset , getVar , hasFlash , __call , logMessage , getRequestParameter , setFlash , getPresentationFor , execute , getFlash , getModuleName , __set , initialize , getResponse , setVar , hasRequestParameter , debugMessage , getContext , __isset , getUser , __get , getActionName , getLogger , sendEmail , getRequest , getVarHolder , getController

Method Details

  • forward404Unless ($condition, $message = &apos;&apos;)

    $condition A condition that evaluates to true or false
    $message Message of the generated exception

    Forwards current action to the default 404 error action unless the specified condition is true.

    throws sfError404Exception

  • setLayout ($name)

    $name Layout name or false to de-activate the layout

    Sets an alternate layout for this sfAction.

    To de-activate the layout, set the layout name to false.
    To revert the layout to the one configured in the view.yml, set the template name to null.

  • (mixed) getCredential ()

    Gets credentials the user must have to access this action.

    returns An array or a string describing the credentials the user must have to access this action

  • postExecute ()

    Execute an application defined process immediately after execution of this sfAction object.

    By default, this method is empty.

  • (bool) isSecure ()

    Indicates that this action requires security.

    returns true, if this action requires security, otherwise false.

  • (string) getSecurityConfiguration ()

    Returns the security configuration for this module.

    returns Current security configuration as an array

  • setViewClass ($class)

    $class View class name

    Changes the default view class used for rendering the template associated with the current action.

  • (sfView::NONE) renderText ($text)

    $text Text to append to the response

    Appends the given text to the response content and bypasses the built-in view system.

    This method must be called as with a return:

    return $this->renderText('some text')

  • (string) getTemplate ()

    Gets the name of the alternate template for this sfAction.

    WARNING: It only returns the template you set with the setTemplate() method, and does not return the template that you configured in your view.yml.
    See 'Naming Conventions' in the 'Symfony View' documentation.

    returns Template name. Returns null if no template has been set within the action

  • (bool) initialize ((sfContext) $context)

    $context The current application context.

    Initializes this action.

    returns true, if initialization completes successfully, otherwise false

  • forward404 ($message = &apos;&apos;)

    $message Message of the generated exception

    Forwards current action to the default 404 error action.

    throws sfError404Exception

  • redirectUnless ($condition, $url)

    $condition A condition that evaluates to true or false
    $url Url

    Redirects current request to a new URL, unless specified condition is true.

    This method stops the action. So, no code is executed after a call to this method.

    throws sfStopException

  • preExecute ()

    Executes an application defined process prior to execution of this sfAction object.

    By default, this method is empty.

  • forward ($module, $action)

    $module A module name
    $action An action name

    Forwards current action to a new one (without browser redirection).

    This method stops the action. So, no code is executed after a call to this method.

    throws sfStopException

  • redirect404 ()

    Redirects current action to the default 404 error action (with browser redirection).

    This method stops the current code flow.

  • (bool) validate ()

    Validates manually files and parameters.

    returns true, if validation completes successfully, otherwise false.

  • setTemplate ($name)

    $name Template name

    Sets an alternate template for this sfAction.

    See 'Naming Conventions' in the 'Symfony View' documentation.

  • redirect ($url, $statusCode = 302)

    $url Url
    $statusCode Status code (default to 302)

    Redirects current request to a new URL.

    2 URL formats are accepted :


    • a full URL: http://www.google.com/

    • an internal URL (url_for() format): module/action



    This method stops the action. So, no code is executed after a call to this method.

    throws sfStopException

  • (mixed) getLayout ()

    Gets the name of the alternate layout for this sfAction.

    WARNING: It only returns the layout you set with the setLayout() method, and does not return the layout that you configured in your view.yml.

    returns Layout name. Returns null if no layout has been set within the action

  • forward404If ($condition, $message = &apos;&apos;)

    $condition A condition that evaluates to true or false
    $message Message of the generated exception

    Forwards current action to the default 404 error action if the specified condition is true.

    throws sfError404Exception

  • redirectIf ($condition, $url)

    $condition A condition that evaluates to true or false
    $url url

    Redirects current request to a new URL, only if specified condition is true.

    This method stops the action. So, no code is executed after a call to this method.

    throws sfStopException

  • forwardUnless ($condition, $module, $action)

    $condition A condition that evaluates to true or false
    $module A module name
    $action An action name

    Unless the condition is true, forwards current action to a new one (without browser redirection).

    This method stops the action. So, no code is executed after a call to this method.

    throws sfStopException

  • (int) getRequestMethods ()

    Retrieves the request methods on which this action will process validation and execution.

    returns

    One of the following values:

    • sfRequest::GET

    • sfRequest::POST

    • sfRequest::PUT

    • sfRequest::DELETE

    • sfRequest::HEAD

    • sfRequest::NONE

  • (string) getDefaultView ()

    Retrieves the default view to be executed when a given request is not served by this action.

    returns A string containing the view name associated with this action

  • (string) handleError ()

    Executes any post-validation error application logic.

    returns A string containing the view name associated with this action

  • forwardIf ($condition, $module, $action)

    $condition A condition that evaluates to true or false
    $module A module name
    $action An action name

    If the condition is true, forwards current action to a new one (without browser redirection).

    This method stops the action. So, no code is executed after a call to this method.

    throws sfStopException

  • setSecurityConfiguration ($security)

    $security The new security configuration

    Overrides the current security configuration for this module.