File tree Expand file tree Collapse file tree 2 files changed +7
-18
lines changed Expand file tree Collapse file tree 2 files changed +7
-18
lines changed Original file line number Diff line number Diff line change 14
14
namespace ApiPlatform \Util ;
15
15
16
16
use ApiPlatform \Api \ResourceClassResolverInterface ;
17
- use ApiPlatform \Core \Metadata \Resource \Factory \ResourceMetadataFactoryInterface ;
18
- use ApiPlatform \Exception \ResourceClassNotFoundException ;
19
17
use ApiPlatform \Metadata \Resource \Factory \ResourceMetadataCollectionFactoryInterface ;
20
18
21
19
/**
@@ -33,7 +31,7 @@ trait ResourceClassInfoTrait
33
31
private $ resourceClassResolver ;
34
32
35
33
/**
36
- * @var ResourceMetadataFactoryInterface| ResourceMetadataCollectionFactoryInterface|null
34
+ * @var ResourceMetadataCollectionFactoryInterface|null
37
35
*/
38
36
private $ resourceMetadataFactory ;
39
37
@@ -66,19 +64,10 @@ private function isResourceClass(string $class): bool
66
64
return $ this ->resourceClassResolver ->isResourceClass ($ class );
67
65
}
68
66
69
- if ($ this ->resourceMetadataFactory instanceof ResourceMetadataCollectionFactoryInterface ) {
67
+ if ($ this ->resourceMetadataFactory ) {
70
68
return \count ($ this ->resourceMetadataFactory ->create ($ class )) > 0 ? true : false ;
71
69
}
72
70
73
- // TODO: 3.0 remove
74
- if ($ this ->resourceMetadataFactory instanceof ResourceMetadataFactoryInterface) {
75
- try {
76
- $ this ->resourceMetadataFactory ->create ($ class );
77
- } catch (ResourceClassNotFoundException $ e ) {
78
- return false ;
79
- }
80
- }
81
-
82
71
// assume that it's a resource class
83
72
return true ;
84
73
}
Original file line number Diff line number Diff line change @@ -109,11 +109,11 @@ public function testBuildSchemaForOperationWithOverriddenSerializerGroups(): voi
109
109
AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES => false ,
110
110
])->withShortName ($ shortName )->withValidationContext (['groups ' => ['validation_groups_dummy_put ' ]]);
111
111
$ resourceMetadataFactoryProphecy ->create (OverriddenOperationDummy::class)
112
- ->willReturn (
113
- new ResourceMetadataCollection (OverriddenOperationDummy::class, [
114
- (new ApiResource ())->withOperations (new Operations (['put ' => $ operation ])),
115
- ])
116
- );
112
+ ->willReturn (
113
+ new ResourceMetadataCollection (OverriddenOperationDummy::class, [
114
+ (new ApiResource ())->withOperations (new Operations (['put ' => $ operation ])),
115
+ ])
116
+ );
117
117
118
118
$ serializerGroup = 'overridden_operation_dummy_put ' ;
119
119
$ validationGroups = 'validation_groups_dummy_put ' ;
You can’t perform that action at this time.
0 commit comments