diff --git a/src/Factory/AbstractFactory.php b/src/Factory/AbstractFactory.php index a280edb..d7f1fd3 100644 --- a/src/Factory/AbstractFactory.php +++ b/src/Factory/AbstractFactory.php @@ -101,6 +101,10 @@ private function adjustNamespace(ReflectionClass $class, string $type): string */ final protected function getTypeFromRegistry(string $type, bool $isEntityId): NamedType { + if ($type === 'ID') { + return Type::id(); + } + if ($this->types->isEntity($type) && $isEntityId) { // @phpstan-ignore-next-line return $this->types->getId($type); diff --git a/tests/Blog/Model/Special/InputWithId.php b/tests/Blog/Model/Special/InputWithId.php new file mode 100644 index 0000000..d36119d --- /dev/null +++ b/tests/Blog/Model/Special/InputWithId.php @@ -0,0 +1,18 @@ +assertType('tests/data/NamespaceSupportInput.graphqls', $actual); } + public function testInputWithId(): void + { + $actual = $this->types->getInput(Blog\Model\Special\InputWithId::class); + $this->assertType('tests/data/InputWithId.graphqls', $actual); + } + public function testInputWithoutTypeMustThrow(): void { $type = $this->types->getInput(Blog\Model\Special\NoTypeInput::class); diff --git a/tests/data/InputWithId.graphqls b/tests/data/InputWithId.graphqls new file mode 100644 index 0000000..a31ceaf --- /dev/null +++ b/tests/data/InputWithId.graphqls @@ -0,0 +1,4 @@ +input InputWithIdInput { + ids: [ID!]! + creationDate: DateTime! +}