Решил я заиспользовать наследование классов и вроде бы все правильно прописал в yml:
My\Entity\B2b:
type: entity
table: b2b
inheritanceType: joined
discriminatorColumn:
name: type
type: string
discriminatorMap:
company: B2bCompany
entrepreneur: B2bEntrepreneur
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
column: name
type: string
length: 256
nullable: false
My\Entity\B2bCompany:
type: entity
table: b2b_company
fields:
fullName:
column: full_name
type: string
length: 256
nullable: false
My\Entity\B2bEntrepreneur:
type: entity
table: b2b_entrepreneur
fields:
passport:
column: passport
type: string
length: 256
nullable: false
и выполнил команду:
bin/doctrine orm:generate-entities src
но doctrine выдала ошибку:
[Doctrine\ORM\Mapping\MappingException]
Entity class 'My\Entity\B2bCompany' used in the discriminator map of class 'My\Entity\B2b' does not exist.
Методом тыка выяснил, что сначала нужно
готово.
Комментарии
Комментариев пока нет.