| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Pz\Doctrine\Rest\Traits; |
||
| 14 | 6 | protected function validateEntity($entity) |
|
| 15 | { |
||
| 16 | 6 | $errors = Validation::createValidatorBuilder() |
|
| 17 | 6 | ->enableAnnotationMapping() |
|
| 18 | 6 | ->getValidator() |
|
| 19 | 6 | ->validate($entity); |
|
| 20 | |||
| 21 | 6 | if ($errors->count() > 0) { |
|
| 22 | 1 | throw RestException::createFromConstraintViolationList($errors); |
|
| 23 | } |
||
| 24 | |||
| 25 | 5 | return $entity; |
|
| 26 | } |
||
| 28 |