symfony API

sfValidatorError Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.4 API OpenSearch

Packages

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

sfValidatorError represents a validation error.

Inheritence

sfValidatorErrorSchema  <  sfValidatorError

Method Summary

  • getArguments($raw)
    Returns the arguments needed to format the message.
  • string getMessageFormat()
    Returns the message format for this error.
  • sfValidatorBase getValidator()
    Returns the validator that triggered this error.
  • mixed getValue()
    Returns the input value that triggered this error.
  • string serialize()
    Serializes the current instance.
  • unserialize($serialized)
    Unserializes a sfValidatorError instance.
  • __construct($validator, $code, $arguments)
    Constructor.
  • string __toString()
    Returns the string representation of the error.

Method Details

  • getArguments ($raw) Browse code

    $raw false to use it as arguments for the message format, true otherwise (default to false)

    Returns the arguments needed to format the message.

  • (string) getMessageFormat () Browse code

    Returns the message format for this error.


    This is the string you need to use if you need to internationalize
    error messages:

    $i18n->__($error->getMessageFormat(), $error->getArguments());

    If no message format has been set in the validator, the exception standard
    message is returned.

    returns The message format

  • (sfValidatorBase) getValidator () Browse code

    Returns the validator that triggered this error.

    returns A sfValidatorBase instance

  • (mixed) getValue () Browse code

    Returns the input value that triggered this error.

    returns The input value

  • (string) serialize () Browse code

    Serializes the current instance.


    We must implement the Serializable interface to overcome a problem with PDO
    used as a session handler.

    The default serialization process serializes the exception trace, and because
    the trace can contain a PDO instance which is not serializable, serializing won't
    work when using PDO.

    returns The instance as a serialized string

  • unserialize ($serialized) Browse code

    $serialized A serialized sfValidatorError instance

    Unserializes a sfValidatorError instance.

  • __construct ($validator, $code, $arguments) Browse code

    $validator An sfValidatorBase instance
    $code The error code
    $arguments An array of named arguments needed to render the error message

    Constructor.

  • (string) __toString () Browse code

    Returns the string representation of the error.

    returns The error message