58
58
use ApiPlatform \JsonApi \JsonSchema \SchemaFactory as JsonApiSchemaFactory ;
59
59
use ApiPlatform \JsonApi \Serializer \CollectionNormalizer as JsonApiCollectionNormalizer ;
60
60
use ApiPlatform \JsonApi \Serializer \EntrypointNormalizer as JsonApiEntrypointNormalizer ;
61
+ use ApiPlatform \JsonApi \Serializer \ErrorNormalizer as JsonApiErrorNormalizer ;
61
62
use ApiPlatform \JsonApi \Serializer \ItemNormalizer as JsonApiItemNormalizer ;
62
63
use ApiPlatform \JsonApi \Serializer \ObjectNormalizer as JsonApiObjectNormalizer ;
63
64
use ApiPlatform \JsonApi \Serializer \ReservedAttributeNameConverter ;
@@ -297,7 +298,7 @@ public function register(): void
297
298
});
298
299
299
300
$ this ->app ->extend (PropertyMetadataFactoryInterface::class, function (PropertyInfoPropertyMetadataFactory $ inner , Application $ app ) {
300
- /** @var ConfigRepository */
301
+ /** @var ConfigRepository $config */
301
302
$ config = $ app ['config ' ];
302
303
303
304
return new CachePropertyMetadataFactory (
@@ -313,12 +314,12 @@ public function register(): void
313
314
$ app ->make (ResourceClassResolverInterface::class)
314
315
),
315
316
),
316
- true === $ config ->get ('app.debug ' ) ? 'array ' : ' file '
317
+ true === $ config ->get ('app.debug ' ) ? 'array ' : $ config -> get ( ' cache.default ' , ' file ')
317
318
);
318
319
});
319
320
320
321
$ this ->app ->singleton (PropertyNameCollectionFactoryInterface::class, function (Application $ app ) {
321
- /** @var ConfigRepository */
322
+ /** @var ConfigRepository $config */
322
323
$ config = $ app ['config ' ];
323
324
324
325
return new CachePropertyNameCollectionMetadataFactory (
@@ -331,7 +332,7 @@ public function register(): void
331
332
)
332
333
)
333
334
),
334
- true === $ config ->get ('app.debug ' ) ? 'array ' : ' file '
335
+ true === $ config ->get ('app.debug ' ) ? 'array ' : $ config -> get ( ' cache.default ' , ' file ')
335
336
);
336
337
});
337
338
@@ -345,7 +346,7 @@ public function register(): void
345
346
346
347
// TODO: add cached metadata factories
347
348
$ this ->app ->singleton (ResourceMetadataCollectionFactoryInterface::class, function (Application $ app ) {
348
- /** @var ConfigRepository */
349
+ /** @var ConfigRepository $config */
349
350
$ config = $ app ['config ' ];
350
351
$ formats = $ config ->get ('api-platform.formats ' );
351
352
@@ -401,7 +402,7 @@ public function register(): void
401
402
$ app ->make ('filters ' )
402
403
)
403
404
),
404
- true === $ config ->get ('app.debug ' ) ? 'array ' : ' file '
405
+ true === $ config ->get ('app.debug ' ) ? 'array ' : $ config -> get ( ' cache.default ' , ' file ')
405
406
);
406
407
});
407
408
@@ -907,6 +908,10 @@ public function register(): void
907
908
return new ReservedAttributeNameConverter ($ app ->make (NameConverterInterface::class));
908
909
});
909
910
911
+ if (interface_exists (FieldsBuilderEnumInterface::class)) {
912
+ $ this ->registerGraphQl ($ this ->app );
913
+ }
914
+
910
915
$ this ->app ->singleton (JsonApiEntrypointNormalizer::class, function (Application $ app ) {
911
916
return new JsonApiEntrypointNormalizer (
912
917
$ app ->make (ResourceMetadataCollectionFactoryInterface::class),
@@ -946,9 +951,11 @@ public function register(): void
946
951
);
947
952
});
948
953
949
- if (interface_exists (FieldsBuilderEnumInterface::class)) {
950
- $ this ->registerGraphQl ($ this ->app );
951
- }
954
+ $ this ->app ->singleton (JsonApiErrorNormalizer::class, function (Application $ app ) {
955
+ return new JsonApiErrorNormalizer (
956
+ $ app ->make (JsonApiItemNormalizer::class),
957
+ );
958
+ });
952
959
953
960
$ this ->app ->singleton (JsonApiObjectNormalizer::class, function (Application $ app ) {
954
961
return new JsonApiObjectNormalizer (
@@ -985,6 +992,7 @@ public function register(): void
985
992
$ list ->insert ($ app ->make (JsonApiEntrypointNormalizer::class), -800 );
986
993
$ list ->insert ($ app ->make (JsonApiCollectionNormalizer::class), -985 );
987
994
$ list ->insert ($ app ->make (JsonApiItemNormalizer::class), -890 );
995
+ $ list ->insert ($ app ->make (JsonApiErrorNormalizer::class), -790 );
988
996
$ list ->insert ($ app ->make (JsonApiObjectNormalizer::class), -995 );
989
997
990
998
if (interface_exists (FieldsBuilderEnumInterface::class)) {
0 commit comments