The documentation of Concrete Inheritance when you use one table per class seems to be missing.
I only figured out you could use InheritanceType TABLE_PER_CLASS by looking at the source code.
There are only 2 types of supported inheritance: single table and joined
table. Where did you find this other one?
On Fri, 24 Aug 2018, 10:19 Terje Bråten, notifications@github.com wrote:
The documentation of Concrete Inheritance when you use one table per class
seems to be missing.I only figured out you could use InheritanceType TABLE_PER_CLASS by
looking at the source code.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7371, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakMPhmcBQQ4DAYESnW4a8Oti0v-F6ks5uT7b_gaJpZM4WK8VP
.
Hmm, interesting, I think this is new and only in master, not yet
anywhere. I'll ask internally, because I don't remember merging anything
related to this feature...
Marco Pivetta
On Fri, Aug 24, 2018 at 11:00 AM Terje Bråten notifications@github.com
wrote:
>
https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/InheritanceType.php
I also found it mentioned at
https://www.doctrine-project.org/api/orm/latest/Doctrine/ORM/Mapping/InheritanceType.html—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7371#issuecomment-415698672,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakD4iNKtu9HLP5cM4SRanB-VDZyrAks5uT8C8gaJpZM4WK8VP
.
It seems to be a deprecated feature instead of a new feature. It was in doctrine 1, but the schema tool in doctrine 2 does not support it.
So, if it is not supported, my question becomes: How do you have Base class A and Child class C be two different entities with two separate tables, but C inherits a lot of its fields (and mappings) from A?
I tried it out with no InheritanceType annotation in base class A, and the schema tool copied over all the normal table fields, but not the @ManyToOne relationships. Why is that?
That's what JTI does
On Fri, 24 Aug 2018, 11:53 Terje Bråten, notifications@github.com wrote:
It seems to be a deprecated feature instead of a new feature. It was in
doctrine 1, but the schema tool in doctrine 2 does not support it.So, if it is not supported, my question becomes: How do you have Base
class A and Child class C be two different entities with two separate
tables, but C inherits a lot of its fields (and mappings) from A?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7371#issuecomment-415711808,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakJHT3puxwR7BgpCKRG3D7Im0_wAoks5uT80ngaJpZM4WK8VP
.
What is JTI?
Do you mean CTI?
https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html#class-table-inheritance
Joined table inheritance - same group of constants
On Fri, 24 Aug 2018, 11:58 Terje Bråten, notifications@github.com wrote:
What is JTI?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7371#issuecomment-415712897,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakHUlwIC5bDl29puEahkKCpBDsAPYks5uT84ogaJpZM4WK8VP
.
But that joins the tables. I want two independent entities with no table joins.
All the columns that are the same in A and C should exist in both tables.
It is like A is a mapped super class for C, but also A is an entity on its own. Is that not possible?
Yep, it's called "Joined" table inheritance all over the codebase
On Fri, 24 Aug 2018, 12:02 Terje Bråten, notifications@github.com wrote:
Do you mean CTI?
https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html#class-table-inheritance
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7371#issuecomment-415713870,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakMOOY_T9LPMXAOmFhOuh7sBuntGWks5uT88kgaJpZM4WK8VP
.
No, that's not currently possible
On Fri, 24 Aug 2018, 12:05 Terje Bråten, notifications@github.com wrote:
But that joins the tables. I want two independent entities with no table
joins.
All the columns that are the same in A and C should exist in both tables.It is like A is a mapped super class for C, but also A is an entity on its
own. Is that not possible?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7371#issuecomment-415714645,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakOaxpsvMR-T83UmT4t8rpUVo1BL_ks5uT8_kgaJpZM4WK8VP
.
Why is that not possible? Would that be problematic in some ways?
It's just not implemented 😬
On Fri, 24 Aug 2018, 12:07 Terje Bråten, notifications@github.com wrote:
Why is that not possible? Would that be problematic in some ways?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7371#issuecomment-415715154,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakLAvG7yvCm1MExzKp1xUtm5N3SKqks5uT9BhgaJpZM4WK8VP
.
Was there a reason you put in the restriction that a Mapped superclass could not also be an Entity?
Yes: a mapped superclass is alike to a trait in PHP: it's not supposed to
have concrete instances of its exact type at runtime, and it's only
supposed supposed to be abstract.
On Fri, 24 Aug 2018, 12:10 Terje Bråten, notifications@github.com wrote:
Was there a reason you put in the restriction that a Mapped superclass
could not also be an Entity?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7371#issuecomment-415715953,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakMDPukpddkZ83ZBtTSvgMhZCewZmks5uT9EigaJpZM4WK8VP
.
This forces me to change my class hierachy, just beacuse the way doctrine works.
I will have to have abstract class "Base", move all code from "A" to "Base" and then empty class "A" inherits "Base" and C inherits "Base". Instead of the more simple structure I first wanted where I just have the 2 classes "A" and "C".
Yep, or you can help building the feature for 3.x :-)
Marco Pivetta
On Fri, Aug 24, 2018 at 12:21 PM Terje Bråten notifications@github.com
wrote:
This forces me to change my class hierachy, just beacuse the way doctrine
works.
I wil have to have abstract class "Base", move all code from "A" to "Base"
and then "A" inherits "Base" and C inherits "Base". Instead of the more
simple structure I first wanted where I just have the 2 classes "A" and "C".—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7371#issuecomment-415718347,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakGD0f-jE_fehbHkxsEn91trPwxItks5uT9OQgaJpZM4WK8VP
.
If I want this feature for 3.x, what would be the best way then?
Should I change Mapped Superclass to also allow it to be an entity?
Or should I introduce a new InheritanceType or try resurrect the InheritanceType TABLE_PER_CLASS?
I'd say pursuing the TABLE_PER_CLASS approach would be best - try getting
in touch with @guilhermeblanco first, as he's been pushing these changes
that you are looking at. Heck, it may even be that master already
supports some of this stuff.
Marco Pivetta
On Fri, Aug 24, 2018 at 12:32 PM Terje Bråten notifications@github.com
wrote:
If I want this feature for 3.x, what would be the best way then?
Should I change Mapped Superclass to also allow it to be an entity?
Or should I introduce a new InheritanceType or try resurrect the
InheritanceType TABLE_PER_CLASS?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7371#issuecomment-415720772,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakPF62h7CGq9J7GjTAvCSs9kXLxiGks5uT9YmgaJpZM4WK8VP
.
Ping 🙃
In the end was there anything on master that would allow this TABLE_PER_CLASS-like inheritance?
hey @TerjeBr, how did you deal with the issue?
I just went on with other things. Sorry.
Most helpful comment
But that joins the tables. I want two independent entities with no table joins.
All the columns that are the same in A and C should exist in both tables.
It is like A is a mapped super class for C, but also A is an entity on its own. Is that not possible?