1 | <?php |
||
37 | abstract class AbstractSerializer implements SerializerAwareInterface |
||
38 | { |
||
39 | /** |
||
40 | * @var ManagerRegistry |
||
41 | */ |
||
42 | protected $managerRegistry; |
||
43 | |||
44 | /** |
||
45 | * @var \Symfony\Component\PropertyAccess\PropertyAccessor |
||
46 | */ |
||
47 | protected $propertyAccessor; |
||
48 | |||
49 | /** |
||
50 | * @var Serializer |
||
51 | */ |
||
52 | protected $serializer; |
||
53 | |||
54 | /** |
||
55 | * @var SerializationMetadataLoaderInterface |
||
56 | */ |
||
57 | protected $serializationMetadataLoader; |
||
58 | |||
59 | /** |
||
60 | * @var \WellCommerce\Component\Serializer\Metadata\Collection\SerializationMetadataCollection |
||
61 | */ |
||
62 | protected $serializationMetadataCollection; |
||
63 | |||
64 | /** |
||
65 | * @var array |
||
66 | */ |
||
67 | protected $context = []; |
||
68 | |||
69 | /** |
||
70 | * @var string |
||
71 | */ |
||
72 | protected $format; |
||
73 | |||
74 | public function __construct(ManagerRegistry $managerRegistry, SerializationMetadataLoaderInterface $serializationMetadataLoader) |
||
81 | |||
82 | public function setSerializer(SerializerInterface $serializer) |
||
90 | |||
91 | protected function getSerializationMetadataCollection(): SerializationMetadataCollection |
||
95 | |||
96 | protected function getSerializationMetadata($entity): SerializationClassMetadataInterface |
||
102 | |||
103 | protected function hasSerializationMetadata($entity): bool |
||
109 | |||
110 | protected function getEntityMetadata($entity): ClassMetadata |
||
117 | |||
118 | /** |
||
119 | * Builds property path in array-notation style from given attribute's name |
||
120 | * |
||
121 | * @param $attributeName |
||
122 | * |
||
123 | * @return PropertyPath |
||
124 | */ |
||
125 | protected function getPropertyPath(string $attributeName): PropertyPath |
||
136 | |||
137 | /** |
||
138 | * Builds a property path from string |
||
139 | * |
||
140 | * @param $propertyName |
||
141 | * |
||
142 | * @return PropertyPath |
||
143 | */ |
||
144 | protected function buildPath(string $propertyName): PropertyPath |
||
155 | |||
156 | /** |
||
157 | * Returns the entity fields |
||
158 | * |
||
159 | * @param ClassMetadata $metadata |
||
160 | * |
||
161 | * @return array |
||
162 | */ |
||
163 | protected function getEntityFields(ClassMetadata $metadata): array |
||
175 | |||
176 | /** |
||
177 | * Returns the entity embeddable fields |
||
178 | * |
||
179 | * @param ClassMetadata $metadata |
||
180 | * |
||
181 | * @return array |
||
182 | */ |
||
183 | protected function getEntityEmbeddables(ClassMetadata $metadata): array |
||
196 | |||
197 | /** |
||
198 | * Returns the entity fields |
||
199 | * |
||
200 | * @param ClassMetadata $metadata |
||
201 | * |
||
202 | * @return array |
||
203 | */ |
||
204 | protected function getEntityAssociations(ClassMetadata $metadata): array |
||
214 | |||
215 | protected function getRealClass($object): string |
||
221 | |||
222 | protected function getEntityManager(string $class = null): ObjectManager |
||
230 | } |
||
231 |