Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sokil/php-symfony-validator-converter


https://github.com/sokil/php-symfony-validator-converter

Last synced: 23 days ago
JSON representation

Awesome Lists containing this project

README

        

# php-symfony-validator-converter

## 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
get('validator')->validate($entity);
if (count($errors) > 0) {
$list = $this
->get('acme.validator.error_converter')
->constraintViolationListToArray($errors);
}
```