GlobalExecutionContextInterface.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator;
  11. /**
  12. * Stores the node-independent state of a validation run.
  13. *
  14. * When the validator validates a graph of objects, it uses two classes to
  15. * store the state during the validation:
  16. *
  17. * <ul>
  18. * <li>For each node in the validation graph (objects, properties, getters) the
  19. * validator creates an instance of {@link ExecutionContextInterface} that
  20. * stores the information about that node.</li>
  21. * <li>One single <tt>GlobalExecutionContextInterface</tt> stores the state
  22. * that is independent of the current node.</li>
  23. * </ul>
  24. *
  25. * @author Bernhard Schussek <bschussek@gmail.com>
  26. */
  27. interface GlobalExecutionContextInterface
  28. {
  29. /**
  30. * Returns the violations generated by the validator so far.
  31. *
  32. * @return ConstraintViolationListInterface A list of constraint violations.
  33. */
  34. public function getViolations();
  35. /**
  36. * Returns the value at which validation was started in the object graph.
  37. *
  38. * @return mixed The root value.
  39. *
  40. * @see ExecutionContextInterface::getRoot
  41. */
  42. public function getRoot();
  43. /**
  44. * Returns the visitor instance used to validate the object graph nodes.
  45. *
  46. * @return ValidationVisitorInterface The validation visitor.
  47. */
  48. public function getVisitor();
  49. /**
  50. * Returns the factory for constraint validators.
  51. *
  52. * @return ConstraintValidatorFactoryInterface The constraint validator factory.
  53. */
  54. public function getValidatorFactory();
  55. /**
  56. * Returns the factory for validation metadata objects.
  57. *
  58. * @return MetadataFactoryInterface The metadata factory.
  59. */
  60. public function getMetadataFactory();
  61. }