ValidationFailedException.php 922 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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\Exception;
  11. use Symfony\Component\Validator\ConstraintViolationListInterface;
  12. /**
  13. * @author Jan Vernieuwe <jan.vernieuwe@phpro.be>
  14. */
  15. class ValidationFailedException extends RuntimeException
  16. {
  17. private $violations;
  18. private $value;
  19. public function __construct($value, ConstraintViolationListInterface $violations)
  20. {
  21. $this->violations = $violations;
  22. $this->value = $value;
  23. parent::__construct($violations);
  24. }
  25. public function getValue()
  26. {
  27. return $this->value;
  28. }
  29. public function getViolations(): ConstraintViolationListInterface
  30. {
  31. return $this->violations;
  32. }
  33. }