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
Adding more options for Single Table Inheritance in Doctrine 2 Annotation #143
Conversation
After further reading, I'm figuring out that it may be possible to make it entirely though single table inheritance (it seems I misunderstood the «SINGLE» word in thinking that hierarchy tree could only have a unique parent entity) : BasePerson (@entity, @InheritanceType("SINGLE_TABLE"), @DiscriminatorMap({"base_person" = "BasePerson", "person" = "Person", "base_man" = "BaseMan", "man" = "Man", "base_woman" = "BaseWoman", "woman" = "Woman"})) Maybe it should be more suitable and simple ? |
how the annotation in the comment table should look in the BasePerson in order to obtain the |
e567230
to
34f4f83
Compare
6 months later, I commited and rebased my enhancements to handle single inheritance while benefits from "base" classes. I added in the same time some functionalities I was needing while developping and testing.
To do:
|
@malutanpetronel, sorry to answer your question so late but I had to finish this before, and so much other things even before. Have a look at my example (particularly, the comments on Tools, Persons, and Skills) and the README.md file. |
thx... no hurry :) anytime an answer is good ;) |
The recent project refactor makes my pull request obsolete. No idea on how to maintain this... |
Hello,
here is my attempt to make Single Inheritance more customizable.
I had to make possible to force generation of array keys in MwbExporter/Object/Annotation.php in order to be able to specify integer discrimanator values. When defining php array keys as string representation of integer, php interprets those as integer, then Annotation::isKeysNumeric is not suficient to determine wether or not to write these keys. In this case (and when discriminator is an integer), discriminatorMap Annotation was not able to write keys, as specified by user. Not sure it was the best way to achieve this.