symfony API

sfAction Class

« Back to API menu

1.1 API OpenSearch

Packages

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

sfAction executes all the logic for the current request.

Inheritence

sfActions  <  sfAction  <  sfComponent

Method Summary

  • string getPartial($templateName, $vars = null)
    Returns the partial rendered content.
  • string get404Message($message = null)
    Returns a formatted message for a 404 error.
  • forward404Unless($condition, $message = null)
    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 getComponent($moduleName, $componentName, $vars = null, $componentNae)
    Returns the component rendered content.
  • string getTemplate()
    Gets the name of the alternate template for this sfAction.
  • bool initialize((sfContext) $context, $moduleName, $actionName)
    Initializes this action.
  • forward404($message = null)
    Forwards current action to the default 404 error action.
  • sfView::NONE renderComponent($moduleName, $componentName, $vars = null, $componentNae)
    Appends the result of the given component execution to the response content.
  • 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, $module = null)
    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 = null)
    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).
  • sfView::NONE renderPartial($templateName, $vars = null)
    Appends the result of the given partial execution to the response content.
  • 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 , __construct , __call , logMessage , getRequestParameter , execute , getModuleName , __set , initialize , getResponse , setVar , hasRequestParameter , debugMessage , getContext , __isset , getUser , __get , getActionName , getLogger , getRequest , getVarHolder , getController

Method Details

  • (string) getPartial ($templateName, $vars = null) 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

  • (string) get404Message ($message = null) 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

  • forward404Unless ($condition, $message = null) 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

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

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

  • postExecute () Browse code

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

    By default, this method is empty.

  • (bool) isSecure () Browse code

    Indicates that this action requires security.

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

  • (string) getSecurityConfiguration () Browse code

    Returns the security configuration for this module.

    returns Current security configuration as an array

  • setViewClass ($class) Browse code

    $class View class name

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

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

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

    $moduleName module name
    $componentName
    $vars vars
    $componentNae component name

    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

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

  • (bool) initialize ((sfContext) $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

  • forward404 ($message = null) Browse code

    $message Message of the generated exception

    Forwards current action to the default 404 error action.

    throws sfError404Exception

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

    $moduleName module name
    $componentName
    $vars vars
    $componentNae component name

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

  • redirectUnless ($condition, $url) Browse code

    $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 () Browse code

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

    By default, this method is empty.

  • 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

  • redirect404 () Browse code

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

    This method stops the current code flow.

  • (bool) validate () Browse code

    Validates manually files and parameters.

    returns true, if validation completes successfully, otherwise false.

  • setTemplate ($name, $module = null) 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.

  • redirect ($url, $statusCode = 302) Browse code

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

    Redirects current request to a new URL.

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

  • forward404If ($condition, $message = null) 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

  • redirectIf ($condition, $url) Browse code

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

  • (sfView::NONE) renderPartial ($templateName, $vars = null) 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')

  • (int) getRequestMethods () Browse code

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

  • (string) handleError () Browse code

    Executes any post-validation error application logic.

    returns A string containing the view name associated with this action

  • 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

  • setSecurityConfiguration ($security) Browse code

    $security The new security configuration

    Overrides the current security configuration for this module.

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.