forestcitylabs / framework

A PSR compliant framework for building web applications.
https://forestcitylabs.github.io/framework/
GNU General Public License v3.0
0 stars 0 forks source link

Enums fail to decode correctly #51

Closed midnightLuke closed 1 week ago

midnightLuke commented 1 week ago

GraphQL cannot decode enums properly, causing issues.

midnightLuke commented 1 week ago

Error message is:

Expected a value of type AppleType but received: instance of Application\\Entity\\AppleType. Cannot serialize value as enum: instance of Application\\Entity\\AppleType
midnightLuke commented 1 week ago

Note that Enums appear to encode correctly.

midnightLuke commented 1 week ago

Enums must be backed for the Doctrine ORM to map them properly.

midnightLuke commented 1 week ago

Based on the documentation we need to put some special logic into the buildObjectField function so that it will account for enums and convert them from a raw enum to the internal representation and let GraphQL take it from there.