Reputation: 453
I have a class inheritance like this
/**
* @ORM\Entity
* @ORM\Table(name="persons")
* @@ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="person_types", type="string")
* @ORM\DiscriminatorMap({
* "insuree" = "Insuree",
* "third_party" = "ThirdParty"
* })
*/
abstract class Person {
/**
* @ORM\Entity
* @ORM\Table(name="insurees")
*/
abstract class Insuree extends Person
/**
* @ORM\Entity
* @ORM\Table(name="third_parties")
*/
final class ThirdParty extends Insuree {
When I executed schema:create, instad of doctrine create the discriminator column on the Person class, it created the persons table with the fields belonging to itself and nothing more, then, created the insurees table with the persons table columns and the columns belonging to itself and then created the third_parties table with the columns from persons and insurees tables and the columns belonging to itself. When I executed EntityManager::flush() all the columns from third_parties table were filled, and both of the other tables were empty. What am I missing? I followed the docs from doctrine official website and it seems I made everything right.
Upvotes: 1
Views: 779
Reputation: 11242
There is a typo in the @InheritanceType annotation:
@@ORM\InheritanceType("JOINED")
You have a double "@".
This causes the annotation to be ignored.
Remove one of the "@".
Upvotes: 1