This is my base/parent entity, setup so its children are using their own tables.
/** * @ORM\Entity * @ORM\Table(name="layer_object") * @ORM\InheritanceType("JOINED") * @ORM\DiscriminatorColumn(name="discr", type="string") * @ORM\DiscriminatorMap({"service"="Service", "aircraft"="Aircraft", ...}) */ class LayerObject {}
Aircraft entity. A simple child that is doing well
/** * @ORM\Entity * @ORM\Table(name="aircraft") */ class Aircraft extends LayerObject
Service entity. A complex child, that itself is using single table inheritance.
/** * @ORM\Entity * @ORM\Table(name="service") * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="discr", type="string") * @ORM\DiscriminatorMap({"ground"="Ground", "onboard"="Onboard"}) */ class Service extends LayerObject {}
A child of the Service entity
/** * @ORM\Entity */ class Ground extends Service {}
app/console doctrine:schema:validate
finds no errors but app/console doctrine:schema:update --force
just won't generate the 'service' table, the one that should use single table inheritance. Seems like the service entity definition is simply ignored.
Sure I could create the SQL for this table by hand, but the application will grow and at some point I will need to use migrations.
Could anyone point me in some direction? Thanks.
Found a duplicate, but there are no answers so far, see: Doctrine 2 multiple level inheritance
Edit:
When I use class table inheritance for the 2nd level too (@ORM\InheritanceType("JOINED")
for the Service
entity) it works pretty well. See: Doctrine2 Multiple level inheritance