for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace SymfonyBundles\ServiceLayer\Result;
use Symfony\Component\Validator\ConstraintViolationInterface;
use Symfony\Component\Validator\ConstraintViolationListInterface;
/**
* Class for receiving validation errors.
*/
final class ValidationResult implements ValidationResultInterface
{
* @var array
private array $errors = [];
* @param ConstraintViolationListInterface $constraintViolationList
public function __construct(ConstraintViolationListInterface $constraintViolationList)
/** @var ConstraintViolationInterface $violation */
foreach ($constraintViolationList as $violation) {
$this->errors[$violation->getPropertyPath()] = [
'message' => $violation->getMessageTemplate(),
'parameters' => $violation->getParameters(),
];
}
* {@inheritdoc}
public function getErrors(): array
return $this->errors;