symfony API

sfAction Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.3 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.3 version. Switch to:

sfAction executes all the logic for the current request.

Inheritence

sfActions  <  sfAction  <  sfComponent

Method Summary

  • forward($module, $action)
    Forwards current action to a new one (without browser redirection).
  • forward404($message)
    Forwards current action to the default 404 error action.
  • forward404If($condition, $message)
    Forwards current action to the default 404 error action if the specified condition is true.
  • forward404Unless($condition, $message)
    Forwards current action to the default 404 error action unless the specified condition is true.
  • forwardIf($condition, $module, $action)
    If the condition is true, forwards current action to a new one (without browser redirection).
  • forwardUnless($condition, $module, $action)
    Unless the condition is true, forwards current action to a new one (without browser redirection).
  • string get404Message($message)
    Returns a formatted message for a 404 error.
  • string getComponent($moduleName, $componentName, $vars)
    Returns the component rendered content.
  • mixed getCredential()
    Gets credentials the user must have to access this action.
  • string getDefaultView()
    Retrieves the default view to be executed when a given request is not served by this action.
  • mixed getLayout()
    Gets the name of the alternate layout for this sfAction.
  • string getPartial($templateName, $vars)
    Returns the partial rendered content.
  • sfRoute getRoute()
    Returns the current route for this request
  • string getSecurityConfiguration()
    Returns the security configuration for this module.
  • mixed getSecurityValue($name, $default)
    Returns a value from security.yml.
  • string getTemplate()
    Gets the name of the alternate template for this sfAction.
  • string handleError()
    Executes any post-validation error application logic.
  • bool initialize($context, $moduleName, $actionName)
    Initializes this action.
  • bool isSecure()
    Indicates that this action requires security.
  • postExecute()
    Execute an application defined process immediately after execution of this sfAction object.
  • preExecute()
    Executes an application defined process prior to execution of this sfAction object.
  • redirect($url, $statusCode)
    Redirects current request to a new URL.
  • redirect404()
    Redirects current action to the default 404 error action (with browser redirection).
  • redirectIf($condition, $url, $statusCode)
    Redirects current request to a new URL, only if specified condition is true.
  • redirectUnless($condition, $url, $statusCode)
    Redirects current request to a new URL, unless specified condition is true.
  • sfView::NONE renderComponent($moduleName, $componentName, $vars)
    Appends the result of the given component execution to the response content.
  • sfView::NONE renderPartial($templateName, $vars)
    Appends the result of the given partial execution to the response content.
  • sfView::NONE renderText($text)
    Appends the given text to the response content and bypasses the built-in view system.
  • setLayout($name)
    Sets an alternate layout for this sfAction.
  • setSecurityConfiguration($security)
    Overrides the current security configuration for this module.
  • setTemplate($name, $module)
    Sets an alternate template for this sfAction.
  • setViewClass($class)
    Changes the default view class used for rendering the template associated with the current action.
  • bool validate()
    Validates manually files and parameters.

Methods inherited from sfComponent

& , debugMessage , execute , generateUrl , getActionName , getContext , getController , getLogger , getMailer , getModuleName , getRequest , getRequestParameter , getResponse , getUser , getVar , getVarHolder , hasRequestParameter , initialize , logMessage , setVar , __call , __construct , __isset , __set , __unset

Method Details

  • forward ($module, $action) Browse code

    $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

  • forward404 ($message) Browse code

    $message Message of the generated exception

    Forwards current action to the default 404 error action.

    throws sfError404Exception

  • forward404If ($condition, $message) Browse code

    $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

  • forward404Unless ($condition, $message) Browse code

    $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

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

    $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

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

    $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

  • (string) get404Message ($message) Browse code

    $message An error message (null by default)

    Returns a formatted message for a 404 error.

    returns The error message or a default one if null

  • (string) getComponent ($moduleName, $componentName, $vars) Browse code

    $moduleName module name
    $componentName component name
    $vars vars

    Returns the component rendered content.


    If the vars parameter is omitted, the action's internal variables
    will be passed, just as it would to a normal template.

    If the vars parameter is set then only those values are
    available in the component.

    returns The component rendered content

  • (mixed) getCredential () Browse code

    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

  • (string) getDefaultView () Browse code

    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

    throws sfConfigurationException If compat_10 is not enabled

  • (mixed) getLayout () Browse code

    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

  • (string) getPartial ($templateName, $vars) Browse code

    $templateName partial name
    $vars vars

    Returns the partial rendered content.


    If the vars parameter is omitted, the action's internal variables
    will be passed, just as it would to a normal template.

    If the vars parameter is set then only those values are
    available in the partial.

    returns The partial content

  • (sfRoute) getRoute () Browse code

    Returns the current route for this request

    returns The route for the request

  • (string) getSecurityConfiguration () Browse code

    Returns the security configuration for this module.

    returns Current security configuration as an array

  • (mixed) getSecurityValue ($name, $default) Browse code

    $name The name of the value to pull from security.yml
    $default The default value to return if none is found in security.yml

    Returns a value from security.yml.

  • (string) getTemplate () Browse code

    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

  • (string) handleError () Browse code

    Executes any post-validation error application logic.

    returns A string containing the view name associated with this action

    throws sfConfigurationException If compat_10 is not enabled

  • (bool) initialize ($context, $moduleName, $actionName) Browse code

    $context The current application context.
    $moduleName The module name.
    $actionName The action name.

    Initializes this action.

    returns true, if initialization completes successfully, otherwise false

  • (bool) isSecure () Browse code

    Indicates that this action requires security.

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

  • postExecute () Browse code

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


    By default, this method is empty.

  • preExecute () Browse code

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


    By default, this method is empty.

  • redirect ($url, $statusCode) Browse code

    $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

  • redirect404 () Browse code

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


    This method stops the current code flow.

  • redirectIf ($condition, $url, $statusCode) Browse code

    $condition A condition that evaluates to true or false
    $url Url
    $statusCode Status code (default to 302)

    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

  • redirectUnless ($condition, $url, $statusCode) Browse code

    $condition A condition that evaluates to true or false
    $url Url
    $statusCode Status code (default to 302)

    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

  • (sfView::NONE) renderComponent ($moduleName, $componentName, $vars) Browse code

    $moduleName module name
    $componentName component name
    $vars vars

    Appends the result of the given component execution to the response content.


    This method must be called as with a return:

    return $this->renderComponent('foo', 'bar')

  • (sfView::NONE) renderPartial ($templateName, $vars) Browse code

    $templateName partial name
    $vars vars

    Appends the result of the given partial execution to the response content.


    This method must be called as with a return:

    return $this->renderPartial('foo/bar')

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

    $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')

  • setLayout ($name) Browse code

    $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.

  • setSecurityConfiguration ($security) Browse code

    $security The new security configuration

    Overrides the current security configuration for this module.

  • setTemplate ($name, $module) Browse code

    $name Template name
    $module The module (current if null)

    Sets an alternate template for this sfAction.


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

  • setViewClass ($class) Browse code

    $class View class name

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

  • (bool) validate () Browse code

    Validates manually files and parameters.

    returns true, if validation completes successfully, otherwise false.

    throws sfConfigurationException If compat_10 is not enabled