1 | <?php |
||
15 | class IdToMediaTransformer implements DataTransformerInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var ObjectManager |
||
19 | */ |
||
20 | private $objectManager; |
||
21 | |||
22 | /** |
||
23 | * @var CurrentValueContainer |
||
24 | */ |
||
25 | private $currentValueContainer; |
||
26 | |||
27 | /** |
||
28 | * @param ObjectManager $objectManager The object manager |
||
29 | * @param CurrentValueContainer $currentValueContainer The current value container |
||
30 | */ |
||
31 | public function __construct(ObjectManager $objectManager, CurrentValueContainer $currentValueContainer) |
||
36 | |||
37 | /** |
||
38 | * @param Media $entity The value in the original representation |
||
39 | * |
||
40 | * @return mixed The value in the transformed representation |
||
|
|||
41 | * |
||
42 | * @throws UnexpectedTypeException when the argument is not an object |
||
43 | * @throws \InvalidArgumentException when the parameter is a collection |
||
44 | */ |
||
45 | public function transform($entity) |
||
63 | |||
64 | /** |
||
65 | * @param string $key |
||
66 | * |
||
67 | * @return Media |
||
68 | * |
||
69 | * @throws UnexpectedTypeException when the parameter is not numeric |
||
70 | * @throws TransformationFailedException when the media item cannot be loaded/found |
||
71 | */ |
||
72 | public function reverseTransform($key) |
||
87 | } |
||
88 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.