Replies: 1 comment 1 reply
-
Yes, make a regular return new GraphQL\Type\Definition\PhpEnumType(<your enum clas>::class, '<name of enum>'); This should do it. See https://webonyx.github.io/graphql-php/type-definitions/enums/#construction-from-php-enum what you can do on your enum to support GraphQL (description and stuff), this works too. Reminds that such an example should be added to the readme... |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To create an enum for a GraphQL type we need to create a class and extend
EnumType
. Would it be possible to use PHP enums instead?Beta Was this translation helpful? Give feedback.
All reactions