ValidatorContextInterface.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Symfony\Component\Validator;
  3. /*
  4. * This file is part of the Symfony package.
  5. *
  6. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. use Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface;
  12. /**
  13. * Stores settings for creating a new validator and creates validators
  14. *
  15. * The methods in this class are chainable, i.e. they return the context
  16. * object itself. When you have finished configuring the new validator, call
  17. * getValidator() to create the it.
  18. *
  19. * <code>
  20. * $validator = $context
  21. * ->classMetadataFactory($customFactory)
  22. * ->getValidator();
  23. * </code>
  24. *
  25. * @author Bernhard Schussek <bernhard.schussek@symfony-project.com>
  26. */
  27. interface ValidatorContextInterface
  28. {
  29. /**
  30. * Sets the class metadata factory used in the new validator
  31. *
  32. * @param ClassMetadataFactoryInterface $classMetadataFactory The factory instance
  33. */
  34. function classMetadataFactory(ClassMetadataFactoryInterface $classMetadataFactory);
  35. /**
  36. * Sets the constraint validator factory used in the new validator
  37. *
  38. * @param ConstraintValidatorFactoryInterface $constraintValidatorFactory The factory instance
  39. */
  40. function constraintValidatorFactory(ConstraintValidatorFactoryInterface $constraintValidatorFactory);
  41. /**
  42. * Creates a new validator with the settings stored in this context
  43. *
  44. * @return ValidatorInterface The new validator
  45. */
  46. function getValidator();
  47. }