Hi everybody. We ran into a weird issue today. We have Doctrine models
configured for class-table inheritance.
We have a model like this:
Class A has a ManyToOne association to class C. At runime, instances of B
(subclass of A) are created and associated to instances of C.
I want B's to be removed automatically when the associated C is removed. If
C features an inverse side association "a" to A that's easy: we annotate
"C::a" with cascade={"remove"}. Now, suppose that I have no inverse side
For example, C is part of a core library and needs (or can) not know who
will feature associations to it. To achieve the same behavior, I cannot use
ondelete=CASCADE on A::c, because inexplicably (to me), removing the
associated C would leave rows in the B table without their counterpart in
A. Is there a reason for Doctrine not to link B and A rows so that B's are
removed when A's are removed, given that B extends A?
I am having trouble maintaining consistency when removing C's, and there's
no reason why I should have an inverse side of the relationship for a
seemingly "no brainer" thing like removing the "child" instance row when
the "father" one is removed. I searched the doc to no avail. It would seem
whenever you have two entities in an is-a relationship, the child class
should be linked to the father so that removing a row from the father table
(e.g. removing an A object) would also delete the corresponding child table
row (that is, also scratching the actual 'B' object).
Any thoughts?!
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.