1 | <?php |
||
10 | final class JmsDoctrineHandler |
||
11 | { |
||
12 | const TYPE = 'DoctrineAssociation'; |
||
13 | |||
14 | /** @var ManagerRegistry */ |
||
15 | private $registry; |
||
16 | /** @var EntityToIdNormalizer */ |
||
17 | private $converter; |
||
18 | |||
19 | /** |
||
20 | * JmsDoctrineHandler constructor. |
||
21 | * |
||
22 | * @param ManagerRegistry $registry |
||
23 | */ |
||
24 | public function __construct(ManagerRegistry $registry) |
||
25 | { |
||
26 | $this->registry = $registry; |
||
27 | $this->converter = new EntityToIdNormalizer($this->registry); |
||
28 | } |
||
29 | |||
30 | public function serializeRelation(VisitorInterface $visitor, $relation, array $type, Context $context) |
||
31 | { |
||
32 | if ($relation instanceof \Traversable) { |
||
33 | $relation = iterator_to_array($relation); |
||
34 | } |
||
35 | |||
36 | if (is_array($relation)) { |
||
37 | return array_map([$this->converter, 'normalize'], $relation); |
||
38 | } |
||
39 | |||
40 | return $this->converter->normalize($relation); |
||
41 | } |
||
42 | |||
43 | public function deserializeRelation(VisitorInterface $visitor, $data, array $type, Context $context) |
||
52 | } |
||
53 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.