symfony API

sfAction Class

« Back to API menu

action

addon

autoload

cache

command

config

controller

creole

database

debug

exception

filter

form

generator

helper

i18n

log

plugin

propel

request

response

routing

storage

task

test

user

util

validator

view

widget

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)

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

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

    $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) getComponent ($moduleName, $componentName, $vars = null, $componentNae)

    $moduleName module name
    $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 ()

    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)

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

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

    $moduleName module name
    $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)

    $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, $module = null)

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

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

    $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

  • (sfView::NONE) renderPartial ($templateName, $vars = null)

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

    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.