-
Notifications
You must be signed in to change notification settings - Fork 99
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
AbstractEntity and input #686
Comments
So, input types don't support inheritance in GraphQL. I think you're going to have to annotate this with a union... /** @param RegularUser|Employee $user */` And actually, this might not work either, since polymorphic input types aren't implemented yet. See #238. Assuming a PR isn't submitted for the above, which would be really great to have... another option would be using |
Just to confirm, this won't work - I tried this way and failed. |
Why in that case ExtendType is needed at all? If we have an individual setters we can just set it without ExtendType. |
|
Oh yes, this makes sense. Thanks for clarifying. I have a little bit different structure so ExtendType won't work for me for that case and only will complicate things - it was easier to modify trait, that was adding this functionality. |
I'm currently working on a project where I'm dealing with abstract inputs and facing some challenges with annotation. I have an entity, let's call it AbstractUser, and several types of users inheriting from it, such as RegularUser and Employee. Additionally, there's another entity named Business, which can be owned by either a RegularUser or an Employee.
In my code, I have a method setUser(AbstractUser $user) which should accept an AbstractUser as a parameter. However, I encountered an issue where using AbstractUser as an input parameter isn't feasible because it's not a final class and cannot be instantiated. In my case it's Doctrine inheritance and annotated entities.
What is the right path in that case?
The text was updated successfully, but these errors were encountered: