|
6 | 6 |
|
7 | 7 | use Doctrine\DBAL\Exception;
|
8 | 8 | use Doctrine\DBAL\Types\Type;
|
9 |
| -use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; |
10 |
| -use Symfony\Component\Serializer\Debug\TraceableNormalizer; |
11 |
| -use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter; |
12 |
| -use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer; |
13 |
| -use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; |
| 9 | +use Pfilsx\PostgreSQLDoctrine\Normalizer\JsonModelNormalizer; |
| 10 | +use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; |
| 11 | +use Symfony\Component\Serializer\Normalizer\NormalizerInterface; |
14 | 12 |
|
15 | 13 | final class JsonModelTypeRegistry
|
16 | 14 | {
|
17 |
| - private static AbstractObjectNormalizer|TraceableNormalizer $objectNormalizer; |
| 15 | + /** |
| 16 | + * @var null|DenormalizerInterface|JsonModelNormalizer|NormalizerInterface |
| 17 | + */ |
| 18 | + private static mixed $objectNormalizer = null; |
18 | 19 |
|
19 | 20 | private static array $typesMap = [];
|
20 | 21 |
|
@@ -45,15 +46,18 @@ public static function hasType(string $name): bool
|
45 | 46 | return array_key_exists($name, self::$typesMap);
|
46 | 47 | }
|
47 | 48 |
|
48 |
| - public static function getObjectNormalizer(): AbstractObjectNormalizer|TraceableNormalizer |
| 49 | + /** |
| 50 | + * @return DenormalizerInterface|JsonModelNormalizer|NormalizerInterface |
| 51 | + */ |
| 52 | + public static function getObjectNormalizer(): mixed |
49 | 53 | {
|
50 |
| - return self::$objectNormalizer ??= new ObjectNormalizer( |
51 |
| - nameConverter: new CamelCaseToSnakeCaseNameConverter(), |
52 |
| - propertyTypeExtractor: new ReflectionExtractor() |
53 |
| - ); |
| 54 | + return self::$objectNormalizer ??= new JsonModelNormalizer(); |
54 | 55 | }
|
55 | 56 |
|
56 |
| - public static function setObjectNormalizer(AbstractObjectNormalizer|TraceableNormalizer $objectNormalizer): void |
| 57 | + /** |
| 58 | + * @param DenormalizerInterface|JsonModelNormalizer|NormalizerInterface $objectNormalizer |
| 59 | + */ |
| 60 | + public static function setObjectNormalizer(mixed $objectNormalizer): void |
57 | 61 | {
|
58 | 62 | self::$objectNormalizer = $objectNormalizer;
|
59 | 63 | }
|
|
0 commit comments