symfony API

sfValidator Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.2 API OpenSearch

Packages

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

sfValidatorBase allows you to apply constraints to user entered parameters.

Method Summary

  • bool execute(&$value, &$error)
    Executes this validator.
  • getContext()
    Retrieves the current application context.
  • mixed getParameter($name, $default = null)
    Retrieves a parameter from the validator.
  • getParameterHolder()
    Retrieves the parameters from the validator.
  • boolean hasParameter($name)
    Indicates whether or not a parameter exist for the validator.
  • bool initialize((sfContext) $context, $parameters = array())
    Initializes this validator.
  • setParameter($name, $value)
    Sets a parameter for the validator.
  • __construct($context, $parameters = array())
    Class constructor.

Method Details

  • (bool) execute (&$value, &$error) Browse code

    &$value A file or parameter value/array
    &$error An error message reference

    Executes this validator.

    returns true, if this validator executes successfully, otherwise false

  • getContext () Browse code

    Retrieves the current application context.

    returns The current sfContext instance

  • (mixed) getParameter ($name, $default = null) Browse code

    $name Parameter name
    $default A default parameter value

    Retrieves a parameter from the validator.

    returns A parameter value

  • getParameterHolder () Browse code

    Retrieves the parameters from the validator.

    returns List of parameters

  • (boolean) hasParameter ($name) Browse code

    $name A parameter name

    Indicates whether or not a parameter exist for the validator.

    returns true, if parameter exists, otherwise false

  • (bool) initialize ((sfContext) $context, $parameters = array()) Browse code

    $context The current application context
    $parameters An associative array of initialization parameters

    Initializes this validator.

    returns true, if initialization completes successfully, otherwise false

  • setParameter ($name, $value) Browse code

    $name A parameter name
    $value A parameter value

    Sets a parameter for the validator.

  • __construct ($context, $parameters = array()) Browse code

    $context
    $parameters

    Class constructor.