Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter plugin with enum fields leave unresovled reference in compiled schema php #484

Open
MasonD opened this issue Jul 18, 2022 · 4 comments

Comments

@MasonD
Copy link
Contributor

MasonD commented Jul 18, 2022

class ClassWithEnum extends DataObject {
  public static $db = [ 'EnumField' => "Enum('OptionOne,OptionTwo','OptionOne')" ];
}
ClassWithEnum:
  fields:
    enumField: true
  operations:
    read: true

The compiled php code will contain a reference to Types::QueryFilterEnumFieldEnumComparator(), which does not exist.

@GuySartorelli
Copy link
Member

Just to clarify, does this actually cause any errors or unexpected behaviour? If so, can you please specify exactly what happens?

@MasonD
Copy link
Contributor Author

MasonD commented Jul 25, 2022

Yes, when a relevant operation is called, a reference error occurs. The underlying problem seems to be that the filter plugin that is enabled by default on read uses that type in the type for the filter input but doesn't create it.

@Martimiz
Copy link

I seem to have run into this issue as well (framework 4.10.12, graphql 4.0.1). The comparator is just never created for Enums in my DataObject.

Is there any news or maybe a solution?

@GuySartorelli
Copy link
Member

Workaround posted by @Martimiz on the public slack:

For anyone who's interested: creating the exact same Enum in the enums section of the GraphQL config, and then adding that Enum as a type to the Model field acts as an interim solution.

Downgrading impact to medium as there is a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants