@@ -60,14 +60,8 @@ public function getPropertyMetadata(string $propertyName): array
60
60
public function getFieldMetadata (string $ propertyName ): array
61
61
{
62
62
if (\array_key_exists ($ propertyName , $ this ->metadata ->fieldMappings )) {
63
- $ metadata = $ this ->metadata ->fieldMappings [$ propertyName ];
64
-
65
- // In doctrine/orm:^3.0; $metadata will be a FieldMapping object
66
- if (!\is_array ($ metadata )) {
67
- return (array ) $ metadata ;
68
- }
69
-
70
- return $ metadata ;
63
+ // Cast to array, because in doctrine/orm:^3.0; $metadata will be a FieldMapping object
64
+ return (array ) $ this ->metadata ->fieldMappings [$ propertyName ];
71
65
}
72
66
73
67
throw new \InvalidArgumentException (sprintf ('The "%s" field does not exist in the "%s" entity. ' , $ propertyName , $ this ->metadata ->getName ()));
@@ -81,14 +75,8 @@ public function getFieldMetadata(string $propertyName): array
81
75
public function getAssociationMetadata (string $ propertyName ): array
82
76
{
83
77
if (\array_key_exists ($ propertyName , $ this ->metadata ->associationMappings )) {
84
- $ metadata = $ this ->metadata ->associationMappings [$ propertyName ];
85
-
86
- // In doctrine/orm:^3.0; $metadata will be an AssociationMapping object
87
- if (!\is_array ($ metadata )) {
88
- return (array ) $ metadata ;
89
- }
90
-
91
- return $ metadata ;
78
+ // Cast to array, because in doctrine/orm:^3.0; $metadata will be an AssociationMapping object
79
+ return (array ) $ this ->metadata ->associationMappings [$ propertyName ];
92
80
}
93
81
94
82
throw new \InvalidArgumentException (sprintf ('The "%s" field does not exist in the "%s" entity. ' , $ propertyName , $ this ->metadata ->getName ()));
0 commit comments