-
-
Notifications
You must be signed in to change notification settings - Fork 311
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
Exclude the "discriminator" column for serialized entities #515
Comments
You can prevent the Doctrine DiscriminatorColumn from being added to the serialized output by using the disabled property of the /**
* @Discriminator(disabled=true)
*/
abstract class Vehicle { }
class Car extends Vehicle { } This works for me. I am not using deserialization on this hierarchy of entities though. For more information, have a look at the usages of the Discriminator Annotation in the serializer repo |
Thank you very much @mostertb. Namespace\Entity:
discriminator:
disabled: true |
It's funny, this question is asking how to exclude it but I'd like to know how to include it! I want to use Doctrine's discriminator column instead of having a separate one for the serializer but I just can't seem to include it whatever I do. |
@andyexeter If you are in an exclude_all policy, this is what I do to have it, with this config example on BaseEntity:
|
@bcastagna A belated thank you! I shelved this project a year ago and have just started to look at it again, your solution works :) |
What is the correct way (if there is one) to @exclude the "discriminator" column existent in entities that uses doctrine inheritance mapping?
I was able to exclude it by using groups but this is just a workaround and I believe won't work for long, see #506.
The text was updated successfully, but these errors were encountered: