class LegacyExecutionContext in Plug 7
An execution context that is compatible with the legacy API (< 2.5).
@since 2.5 @author Bernhard Schussek <bschussek@gmail.com>
Hierarchy
- class \Symfony\Component\Validator\Context\ExecutionContext implements ExecutionContextInterface- class \Symfony\Component\Validator\Context\LegacyExecutionContext
 
Expanded class hierarchy of LegacyExecutionContext
Deprecated
Implemented for backwards compatibility with Symfony < 2.5. To be removed in Symfony 3.0.
1 file declares its use of LegacyExecutionContext
- AbstractConstraintValidatorTest.php in lib/Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Constraints/ AbstractConstraintValidatorTest.php 
File
- lib/Symfony/ validator/ Symfony/ Component/ Validator/ Context/ LegacyExecutionContext.php, line 28 
Namespace
Symfony\Component\Validator\ContextView source
class LegacyExecutionContext extends ExecutionContext {
  /**
   * @var MetadataFactoryInterface
   */
  private $metadataFactory;
  /**
   * Creates a new context.
   *
   * @see ExecutionContext::__construct()
   *
   * @internal Called by {@link LegacyExecutionContextFactory}. Should not be used
   *           in user code.
   */
  public function __construct(ValidatorInterface $validator, $root, MetadataFactoryInterface $metadataFactory, TranslatorInterface $translator, $translationDomain = null) {
    parent::__construct($validator, $root, $translator, $translationDomain);
    $this->metadataFactory = $metadataFactory;
  }
  /**
   * {@inheritdoc}
   */
  public function addViolation($message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) {
    if (func_num_args() > 2) {
      $this
        ->buildViolation($message, $parameters)
        ->setInvalidValue($invalidValue)
        ->setPlural($plural)
        ->setCode($code)
        ->addViolation();
      return;
    }
    parent::addViolation($message, $parameters);
  }
  /**
   * {@inheritdoc}
   */
  public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) {
    if (func_num_args() > 2) {
      $this
        ->buildViolation($message, $parameters)
        ->atPath($subPath)
        ->setInvalidValue($invalidValue)
        ->setPlural($plural)
        ->setCode($code)
        ->addViolation();
      return;
    }
    $this
      ->buildViolation($message, $parameters)
      ->atPath($subPath)
      ->addViolation();
  }
  /**
   * {@inheritdoc}
   */
  public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false) {
    if (is_array($value)) {
      // The $traverse flag is ignored for arrays
      $constraint = new Valid(array(
        'traverse' => true,
        'deep' => $deep,
      ));
      return $this
        ->getValidator()
        ->inContext($this)
        ->atPath($subPath)
        ->validate($value, $constraint, $groups);
    }
    if ($traverse && $value instanceof \Traversable) {
      $constraint = new Valid(array(
        'traverse' => true,
        'deep' => $deep,
      ));
      return $this
        ->getValidator()
        ->inContext($this)
        ->atPath($subPath)
        ->validate($value, $constraint, $groups);
    }
    return $this
      ->getValidator()
      ->inContext($this)
      ->atPath($subPath)
      ->validate($value, null, $groups);
  }
  /**
   * {@inheritdoc}
   */
  public function validateValue($value, $constraints, $subPath = '', $groups = null) {
    return $this
      ->getValidator()
      ->inContext($this)
      ->atPath($subPath)
      ->validate($value, $constraints, $groups);
  }
  /**
   * {@inheritdoc}
   */
  public function getMetadataFactory() {
    return $this->metadataFactory;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| ExecutionContext:: | private | property | The currently validated constraint. | |
| ExecutionContext:: | private | property | The currently validated group. | |
| ExecutionContext:: | private | property | Stores which objects have been initialized. | |
| ExecutionContext:: | private | property | The current validation metadata. | |
| ExecutionContext:: | private | property | The currently validated object. | |
| ExecutionContext:: | private | property | The property path leading to the current value. | |
| ExecutionContext:: | private | property | The root value of the validated object graph. | |
| ExecutionContext:: | private | property | ||
| ExecutionContext:: | private | property | ||
| ExecutionContext:: | private | property | Stores which class constraint has been validated for which object. | |
| ExecutionContext:: | private | property | Stores which objects have been validated in which group. | |
| ExecutionContext:: | private | property | ||
| ExecutionContext:: | private | property | The currently validated value. | |
| ExecutionContext:: | private | property | The violations generated in the current context. | |
| ExecutionContext:: | public | function | Returns a builder for adding a violation with extended information. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns the class name of the current node. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns the validation group that is currently being validated. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns the metadata for the currently validated value. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns the currently validated object. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns the property name of the current node. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns the property path to the value that the validator is currently
validating. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns the value at which validation was started in the object graph. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns the validator. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns the value that the validator is currently validating. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns the violations generated by the validator so far. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns whether a constraint was validated for an object. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns whether an object was validated in a specific validation group. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Returns whether an object was initialized. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Marks a constraint as validated for an object. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Marks an object as validated in a specific validation group. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Marks that an object was initialized. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Sets the currently validated constraint. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Sets the currently validated group. Overrides ExecutionContextInterface:: | |
| ExecutionContext:: | public | function | Sets the currently validated value. Overrides ExecutionContextInterface:: | |
| LegacyExecutionContext:: | private | property | ||
| LegacyExecutionContext:: | public | function | Adds a violation at the current node of the validation graph. Overrides ExecutionContext:: | |
| LegacyExecutionContext:: | public | function | Adds a violation at the validation graph node with the given property
path relative to the current property path. Overrides ExecutionContext:: | |
| LegacyExecutionContext:: | public | function | Returns the used metadata factory. Overrides ExecutionContext:: | |
| LegacyExecutionContext:: | public | function | Validates the given value within the scope of the current validation. Overrides ExecutionContext:: | |
| LegacyExecutionContext:: | public | function | Validates a value against a constraint. Overrides ExecutionContext:: | |
| LegacyExecutionContext:: | public | function | Creates a new context. Overrides ExecutionContext:: | 
