sokil / php-symfony-validator-converter
Convert validation errors from different sources to different formats
1.0.4
2017-03-19 19:27 UTC
Requires
- php: ^5.5 || ^7.0
- symfony/validator: >=2.8 | >=3.2
Requires (Dev)
- phpunit/phpunit: 4.8.*
- satooshi/php-coveralls: 1.0.*
- symfony/form: >=2.8 | >=3.2
Suggests
- symfony/form: >=2.8 | >=3.2
This package is auto-updated.
Last update: 2024-11-28 01:58:48 UTC
README
Installation
Add requirement to composer:
composer require sokil/php-symfony-validator-converter
Add service to app or bundle services config:
acme.validator.error_converter:
class: Sokil\Converter\ValidationErrorsConverter
Usage
<?php $errors = $this->get('validator')->validate($entity); if (count($errors) > 0) { $list = $this ->get('acme.validator.error_converter') ->constraintViolationListToArray($errors); }