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

Native PHP Enum fails #1092

Closed
nkamuo opened this issue Jan 25, 2023 · 16 comments
Closed

Native PHP Enum fails #1092

nkamuo opened this issue Jan 25, 2023 · 16 comments

Comments

@nkamuo
Copy link

nkamuo commented Jan 25, 2023

Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Version/Branch 0.15.2

Using PHP 8.1 native Enum with #[Enum] Attributes Fails.

I have an Enum File with the following contents

@Vincz
Copy link
Collaborator

Vincz commented Jan 25, 2023

Hey @nkamuo! Enum are supposed to work with the latest branch. What is your problem with the Enum? Can you share a piece of code?

@nkamuo
Copy link
Author

nkamuo commented Jan 25, 2023

I have a PHP Enum File with the Following contents:

And I get this Error:

Invalid type for path "overblog_graphql_types.VehicleStatus._enum_config.values.PENDING.value". Expected "scalar",
but got "App\Entity\Transport\Vehicle\VehicleStatus".

@Vincz
Copy link
Collaborator

Vincz commented Jan 25, 2023

Can you post your enum?

@nkamuo
Copy link
Author

nkamuo commented Jan 25, 2023

`<?php
namespace App\Entity\Transport\Vehicle;
use Overblog\GraphQLBundle\Annotation\Enum;

#[Enum]
enum VehicleStatus: string{

case PENDING = 'pending';

case ACTIVE = 'active';

case SUSPENDED = 'suspended';

}
`

@fp-cfr
Copy link

fp-cfr commented Jan 30, 2023

Same here with v0.14.

@konnisoelch
Copy link

Same for me @ v0.14.

@AlexOstrovsky
Copy link

Native PHP 8.1 enums work for me on master branch. Are they supposted to work also on 0.15? @Vincz

@eteos
Copy link

eteos commented Feb 21, 2023

I think the issue is that the latest GraphQLBundle version (0.15.2) requires "webonyx/graphql-php": "^14.5", whilst webonyx enum support is in "webonyx/graphql-php": "^15.0"

@nkamuo
Copy link
Author

nkamuo commented May 9, 2023

I think the issue is that the latest GraphQLBundle version (0.15.2) requires "webonyx/graphql-php": "^14.5", whilst webonyx enum support is in "webonyx/graphql-php": "^15.0"

How do you sugget I resolve this?

@nkamuo
Copy link
Author

nkamuo commented May 9, 2023

Native PHP 8.1 enums work for me on master branch. Are they supposted to work also on 0.15? @Vincz

It doesn't work for me. Do you use any special config to make it work?

@Vincz
Copy link
Collaborator

Vincz commented May 10, 2023

Yes, the problem is the dependency to webonyx/graphql-php version 14.x. The support was added in v15.0.0
This week, I'll fix the remaining tests and publish a v0.15.3.

@bogdandubyk
Copy link

any updates here? for me still not working, and as far as I can see v0.15.3 still not released?

@Vincz
Copy link
Collaborator

Vincz commented May 29, 2023

Hi @bogdandubyk! We are waiting a couple of days for #1119, #1071 and #1108 to get fixed by their respective contributors and we will publish a new release.

@bogdandubyk
Copy link

sure, thank you for the quick response, I'll use dev-master for now on the local machine

@vladdnepr
Copy link

Hi @bogdandubyk! We are waiting a couple of days for #1119, #1071 and #1108 to get fixed by their respective contributors and we will publish a new release.

Sorry, but now I don't have free time for #1108

Maybe we release this issue later in another release?

@Vincz
Copy link
Collaborator

Vincz commented Jul 7, 2023

The v1.0 has been released !

@Vincz Vincz closed this as completed Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants