AtLeastOneOf.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\Constraints;
  11. /**
  12. * @Annotation
  13. * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
  14. *
  15. * @author Przemysław Bogusz <przemyslaw.bogusz@tubotax.pl>
  16. */
  17. class AtLeastOneOf extends Composite
  18. {
  19. public const AT_LEAST_ONE_OF_ERROR = 'f27e6d6c-261a-4056-b391-6673a623531c';
  20. protected static $errorNames = [
  21. self::AT_LEAST_ONE_OF_ERROR => 'AT_LEAST_ONE_OF_ERROR',
  22. ];
  23. public $constraints = [];
  24. public $message = 'This value should satisfy at least one of the following constraints:';
  25. public $messageCollection = 'Each element of this collection should satisfy its own set of constraints.';
  26. public $includeInternalMessages = true;
  27. public function getDefaultOption()
  28. {
  29. return 'constraints';
  30. }
  31. public function getRequiredOptions()
  32. {
  33. return ['constraints'];
  34. }
  35. protected function getCompositeOption()
  36. {
  37. return 'constraints';
  38. }
  39. }