| Conditions | 3 |
| Paths | 3 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function onPostDeserialize(ObjectEvent $event) |
||
| 28 | { |
||
| 29 | $context = $event->getContext(); |
||
| 30 | |||
| 31 | if ($context->getDepth() > 0) { |
||
| 32 | return; |
||
| 33 | } |
||
| 34 | |||
| 35 | $groups = $context->attributes->get('groups')->getOrElse(null); |
||
| 36 | |||
| 37 | $list = $this->validator->validate($event->getObject(), $groups); |
||
| 38 | |||
| 39 | if ($list->count() > 0) { |
||
| 40 | throw new EntityProcessingException( |
||
| 41 | 'Data for the entity is not valid', |
||
| 42 | array_map( |
||
| 43 | function (ConstraintViolationInterface $violation) { |
||
| 44 | return $violation->getMessage(); |
||
| 45 | }, |
||
| 46 | iterator_to_array($list) |
||
| 47 | ) |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | } |
||
| 51 | } |
||
| 52 |