@@ -130,17 +130,20 @@ private function getResourceType(Type $type, bool $input, Operation $rootOperati
130
130
return null ;
131
131
}
132
132
133
- $ propertyMetadata = null ;
134
- if ($ property ) {
135
- $ context = [
136
- 'normalization_groups ' => $ rootOperation ->getNormalizationContext ()['groups ' ] ?? null ,
137
- 'denormalization_groups ' => $ rootOperation ->getDenormalizationContext ()['groups ' ] ?? null ,
138
- ];
139
- $ propertyMetadata = $ this ->propertyMetadataFactory ->create ($ rootResource , $ property , $ context );
140
- }
133
+ // TODO: improve this
134
+ if ($ input ) {
135
+ $ propertyMetadata = null ;
136
+ if ($ property ) {
137
+ $ context = [
138
+ 'normalization_groups ' => $ rootOperation ->getNormalizationContext ()['groups ' ] ?? null ,
139
+ 'denormalization_groups ' => $ rootOperation ->getDenormalizationContext ()['groups ' ] ?? null ,
140
+ ];
141
+ $ propertyMetadata = $ this ->propertyMetadataFactory ->create ($ rootResource , $ property , $ context );
142
+ }
141
143
142
- if ($ input && $ depth > 0 && (!$ propertyMetadata || !$ propertyMetadata ->isWritableLink ())) {
143
- return GraphQLType::string ();
144
+ if ($ depth > 0 && (!$ propertyMetadata || !$ propertyMetadata ->isWritableLink ())) {
145
+ return GraphQLType::string ();
146
+ }
144
147
}
145
148
146
149
$ operationName = $ rootOperation ->getName ();
@@ -162,9 +165,13 @@ private function getResourceType(Type $type, bool $input, Operation $rootOperati
162
165
/** @var Operation $operation */
163
166
$ operation = ($ isCollection ? new QueryCollection () : new Query ())
164
167
->withResource ($ resourceMetadataCollection [0 ])
165
- ->withName ($ operationName );
168
+ ->withName ($ operationName ); // TODO: use GraphQlNestedOperationResourceMetadataFactory
166
169
}
167
170
171
+ // if ($rootOperation->getExtraProperties()['_graphql_nested_operation'] ?? false) {
172
+ // $operation = $operation->withExtraProperties(['_graphql_nested_operation' => true], $operation->getExtraProperties());
173
+ // }
174
+
168
175
return $ this ->typeBuilder ->getResourceObjectType ($ resourceClass , $ resourceMetadataCollection , $ operation , $ input , false , $ depth );
169
176
}
170
177
0 commit comments