symfony API

sfAction Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

Packages

You are currently browsing the symfony API for the 1.0 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfAction executes all the logic for the current request.

Inheritence

sfActions  <  sfAction  <  sfComponent

Method Summary

  • forward(, )
    Forwards current action to a new one (without browser redirection).
  • forward404()
    Forwards current action to the default 404 error action.
  • forward404If(, )
    Forwards current action to the default 404 error action if the specified condition is true.
  • forward404Unless(, )
    Forwards current action to the default 404 error action unless the specified condition is true.
  • forwardIf(, , )
    If the condition is true, forwards current action to a new one (without browser redirection).
  • forwardUnless(, , )
    Unless the condition is true, forwards current action to a new one (without browser redirection).
  • 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.
  • int getRequestMethods()
    Retrieves the request methods on which this action will process validation and execution.
  • string getSecurityConfiguration()
    Returns the security configuration for this module.
  • string getTemplate()
    Gets the name of the alternate template for this sfAction.
  • string handleError()
    Executes any post-validation error application logic.
  • bool initialize()
    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(, )
    Redirects current request to a new URL.
  • redirect404()
    Redirects current action to the default 404 error action (with browser redirection).
  • redirectIf(, )
    Redirects current request to a new URL, only if specified condition is true.
  • redirectUnless(, )
    Redirects current request to a new URL, unless specified condition is true.
  • sfView::NONE renderText()
    Appends the given text to the response content and bypasses the built-in view system.
  • setLayout()
    Sets an alternate layout for this sfAction.
  • setSecurityConfiguration()
    Overrides the current security configuration for this module.
  • setTemplate()
    Sets an alternate template for this sfAction.
  • setViewClass()
    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 , getActionName , getContext , getController , getFlash , getLogger , getModuleName , getPresentationFor , getRequest , getRequestParameter , getResponse , getUser , getVar , getVarHolder , hasFlash , hasRequestParameter , initialize , logMessage , sendEmail , setFlash , setVar , __call , __isset , __set , __unset

Method Details

  • forward (, )

    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 ()

    Forwards current action to the default 404 error action.

    throws sfError404Exception

  • forward404If (, )

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

    throws sfError404Exception

  • forward404Unless (, )

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

    throws sfError404Exception

  • forwardIf (, , )

    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 (, , )

    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

  • (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

  • (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

  • (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

  • (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) getSecurityConfiguration ()

    Returns the security configuration for this module.

    returns Current security configuration as an array

  • (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

  • (string) handleError ()

    Executes any post-validation error application logic.

    returns A string containing the view name associated with this action

  • (bool) initialize ()

    Initializes this action.

    returns true, if initialization completes successfully, otherwise false

  • (bool) isSecure ()

    Indicates that this action requires security.

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

  • postExecute ()

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


    By default, this method is empty.

  • preExecute ()

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


    By default, this method is empty.

  • redirect (, )

    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 ()

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


    This method stops the current code flow.

  • redirectIf (, )

    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 (, )

    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) renderText ()

    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 ()

    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 ()

    Overrides the current security configuration for this module.

  • setTemplate ()

    Sets an alternate template for this sfAction.


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

  • setViewClass ()

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

  • (bool) validate ()

    Validates manually files and parameters.

    returns true, if validation completes successfully, otherwise false.