When using ORMInfrastructure::createWithDependenciesFor(), the EntityDependencyResolver class would try to find all classes related to the given base set and also create (temporary) tables for them.
That comes in handy when you have a "snowflake"-like schema where a "core" class has associations to a few supporting/surrounding classes.
Until now, the EntityDependencyResolver would also go up in inheritance relationships and would attempt to create tables for parent classes as well. With this PR, behavior is changed to only create such tables when they are necessary because of single or joined table inheritance.
Why is that helpful?
Assume you're extending from a base class that comes from another package/author. That class may have @ORM\Entity and related annotations, but you chose to setup the Doctrine Mapping in a way that classes from this other package are ignored.
Now when you extend such a class, the EntityDependencyResolver would include the class in the mapping. Depending on circumstances, you might for example end up with duplicate table errors when both classes use the same "local" name and do not provide a table parameter in the @Entity mapping.
Since there is no need to include parent classes unless they are part of a Doctrine Inheritance Type Mapping, this will prevent the error.
When using
ORMInfrastructure::createWithDependenciesFor()
, theEntityDependencyResolver
class would try to find all classes related to the given base set and also create (temporary) tables for them.That comes in handy when you have a "snowflake"-like schema where a "core" class has associations to a few supporting/surrounding classes.
Until now, the
EntityDependencyResolver
would also go up in inheritance relationships and would attempt to create tables for parent classes as well. With this PR, behavior is changed to only create such tables when they are necessary because of single or joined table inheritance.Why is that helpful?
Assume you're extending from a base class that comes from another package/author. That class may have
@ORM\Entity
and related annotations, but you chose to setup the Doctrine Mapping in a way that classes from this other package are ignored.Now when you extend such a class, the
EntityDependencyResolver
would include the class in the mapping. Depending on circumstances, you might for example end up with duplicate table errors when both classes use the same "local" name and do not provide atable
parameter in the@Entity
mapping.Since there is no need to include parent classes unless they are part of a Doctrine Inheritance Type Mapping, this will prevent the error.