Skip to content

Table Inheritance: what is a leaf entity? #8854

Discussion options

You must be logged in to vote

Can I have a Automobile entity with a relationship with AbstractEngine?

Yes, it can, but there will be a performance hit you would not have if you were using a leaf entity: the cost in performance is the cost of hydrating the engine, from what I understand. When you instantiate an Automobile, the ORM cannot create a proxy instance for the engine, so it will:

  • perform an SQL request to get the engine's data
  • hydrate an instance of AbstractEngine with that data

If you are instead targeting a leaf class, the query + hydration would only happen when doing $automobile->engine()->name(). In the first case, it happens when doing new Automobile().

While there is a performance hit, it's probably…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@beberlei
Comment options

Answer selected by beberlei
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants