symfony API

sfRequest Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.1 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.1 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.

sfRequest provides methods for manipulating client request information such

Inheritence

sfConsoleRequest, sfWebRequest  <  sfRequest

Method Summary

  • array extractParameters($names)
    Extracts parameter values from the request.
  • mixed getAttribute($name, $default)
    Retrieves an attribute from the current request.
  • sfParameterHolder getAttributeHolder()
    Retrieves the attributes holder.
  • string getError($name)
    Retrieves an error message.
  • array getErrorNames()
    Retrieves an array of error names.
  • array getErrors()
    Retrieves an array of errors.
  • int getMethod()
    Retrieves this request's method.
  • getParameter($name, $default)
    Retrieves a paramater for the current request.
  • sfParameterHolder getParameterHolder()
    Retrieves the parameters for the current request.
  • bool hasAttribute($name)
    Indicates whether or not an attribute exist for the current request.
  • bool hasError($name)
    Indicates whether or not an error exists.
  • bool hasErrors()
    Indicates whether or not any errors exist.
  • bool hasParameter($name)
    Indicates whether or not a parameter exist for the current request.
  • bool initialize($dispatcher, $parameters, $attributes)
    Initializes this sfRequest.
  • string removeError($name)
    Removes an error.
  • setAttribute($name, $value)
    Sets an attribute for the request.
  • setError($name, $message)
    Sets an error.
  • setErrors($erros)
    Sets an array of errors
  • setMethod($methodCode)
    Sets the request method.
  • setParameter($name, $value)
    Sets a parameter for the current request.
  • mixed __call($method, $arguments)
    Calls methods defined via sfEventDispatcher.
  • __construct()
    Class constructor.

Method Details

  • (array) extractParameters ($names) Browse code

    $names An indexed array of parameter names to extract

    Extracts parameter values from the request.

    returns An associative array of parameters and their values. If a specified parameter doesn't exist an empty string will be returned for its value

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

    $name Attribute name
    $default Default attribute value

    Retrieves an attribute from the current request.

    returns An attribute value

  • (sfParameterHolder) getAttributeHolder () Browse code

    Retrieves the attributes holder.

    returns The attribute holder

  • (string) getError ($name) Browse code

    $name An error name

    Retrieves an error message.

    returns An error message, if the error exists, otherwise null

  • (array) getErrorNames () Browse code

    Retrieves an array of error names.

    returns An indexed array of error names

  • (array) getErrors () Browse code

    Retrieves an array of errors.

    returns An associative array of errors

  • (int) getMethod () Browse code

    Retrieves this request's method.

    returns One of the following constants: - sfRequest::GET - sfRequest::POST

  • getParameter ($name, $default) Browse code

    $name Parameter name
    $default Parameter default value

    Retrieves a paramater for the current request.

  • (sfParameterHolder) getParameterHolder () Browse code

    Retrieves the parameters for the current request.

    returns The parameter holder

  • (bool) hasAttribute ($name) Browse code

    $name Attribute name

    Indicates whether or not an attribute exist for the current request.

    returns true, if the attribute exists otherwise false

  • (bool) hasError ($name) Browse code

    $name An error name

    Indicates whether or not an error exists.

    returns true, if the error exists, otherwise false

  • (bool) hasErrors () Browse code

    Indicates whether or not any errors exist.

    returns true, if any error exist, otherwise false

  • (bool) hasParameter ($name) Browse code

    $name Parameter name

    Indicates whether or not a parameter exist for the current request.

    returns true, if the paramater exists otherwise false

  • (bool) initialize ($dispatcher, $parameters, $attributes) Browse code

    $dispatcher An sfEventDispatcher instance
    $parameters An associative array of initialization parameters
    $attributes An associative array of initialization attributes

    Initializes this sfRequest.

    returns true, if initialization completes successfully, otherwise false

    throws sfInitializationException If an error occurs while initializing this sfRequest

  • (string) removeError ($name) Browse code

    $name An error name

    Removes an error.

    returns An error message, if the error was removed, otherwise null

  • setAttribute ($name, $value) Browse code

    $name Attribute name
    $value Value for the attribute

    Sets an attribute for the request.

  • setError ($name, $message) Browse code

    $name An error name
    $message An error message

    Sets an error.

  • setErrors ($erros) Browse code

    $erros An associative array of errors and their associated messages

    Sets an array of errors


    If an existing error name matches any of the keys in the supplied
    array, the associated message will be overridden.

  • setMethod ($methodCode) Browse code

    $methodCode One of the following constants: - sfRequest::GET - sfRequest::POST - sfRequest::PUT - sfRequest::DELETE - sfRequest::HEAD

    Sets the request method.

    throws sfException - If the specified request method is invalid

  • setParameter ($name, $value) Browse code

    $name Parameter name
    $value Parameter value

    Sets a parameter for the current request.

  • (mixed) __call ($method, $arguments) Browse code

    $method The method name
    $arguments The method arguments

    Calls methods defined via sfEventDispatcher.

    returns The returned value of the called method

    throws sfException if call fails

  • __construct () Browse code

    Class constructor.