File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
fixtures/annotations/Input Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -636,7 +636,14 @@ private static function getGraphQLInputFieldsFromAnnotations(GraphClass $graphCl
636636 }
637637
638638 $ fieldName = $ reflector ->getName ();
639- $ fieldType = $ fieldAnnotation ->type ?? self ::guessType ($ graphClass , $ annotations );
639+ $ fieldType = $ fieldAnnotation ->type ?? null ;
640+ if (!$ fieldType ) {
641+ if ($ reflector instanceof ReflectionProperty && $ reflector ->hasType ()) {
642+ $ fieldType = self ::resolveGraphQLTypeFromReflectionType ($ reflector ->getType (), self ::VALID_INPUT_TYPES );
643+ } else {
644+ $ fieldType = self ::guessType ($ graphClass , $ annotations );
645+ }
646+ }
640647 $ fieldConfiguration = [];
641648 if ($ fieldType ) {
642649 // Resolve a PHP class from a GraphQL type
Original file line number Diff line number Diff line change @@ -188,6 +188,8 @@ public function testInput(): void
188188 'fields ' => [
189189 'name ' => ['type ' => 'String! ' ],
190190 'population ' => ['type ' => 'Int! ' ],
191+ 'description ' => ['type ' => 'String! ' ],
192+ 'diameter ' => ['type ' => 'Int ' ],
191193 ],
192194 ]);
193195 }
Original file line number Diff line number Diff line change 44
55namespace Overblog \GraphQLBundle \Tests \Config \Parser \fixtures \annotations \Input ;
66
7+ use Doctrine \ORM \Mapping as ORM ;
78use Overblog \GraphQLBundle \Annotation as GQL ;
89
910/**
@@ -21,4 +22,17 @@ class Planet
2122 * @GQL\Field(type="Int!")
2223 */
2324 protected string $ population ;
25+
26+ /**
27+ * @GQL\Field
28+ */
29+ protected string $ description ;
30+
31+ /**
32+ * @GQL\Field
33+ * @ORM\Column(type="integer", nullable=true)
34+ */
35+ protected $ diameter ;
36+
37+ protected $ dummy ;
2438}
You can’t perform that action at this time.
0 commit comments