you are right with your assumptions On Fri, May 26, 2017 at 5:49 PM, Marc Verney <[email protected]> wrote:
> Hello, > > According to the doc > <http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/inheritance-mapping.html#id4> > : > > If the target-entity of a many-to-one or one-to-one association is a CTI >> entity, it is preferable for performance reasons that it be a leaf entity >> in the inheritance hierarchy, (ie. have no subclasses). Otherwise Doctrine >> *CANNOT* create proxy instances of this entity and will *ALWAYS* load >> the entity eagerly. > > > > Let's say Cat and Dog extend from Animal (Class Table Inheritance) and I'd > like both of them to have Fleas. I'll therefore declare an "animal" field > in my Flea entity and make it *@ManyToOne(targetEntity="Animal")*. Note > that in my whole model, no association is declared towards Flea (no "fleas" > field in Animal, Cat or Dog, for instance). > > Are the following assumptions correct, please? > > - when I fetch Fleas from my FleaRepository, there will be a > performance impact: the corresponding Animal will always be fetched because > Doctrine must know its type (Cat or a Dog) > - any other query to fetch any other entity won't be impacted, as none > points at the Flea entity. For instance, a Cat object has no inverse > relationship to Flea, so no performance impact. > > > Thanks > > -- > 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 https://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/d/optout. > -- 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 https://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
