如何创建具有适用于生成:实体的继承的mapping.yaml'命令?我试过这样:
Acme\EdgarMainBundle\Entity\Address:
type: entity
table: address
repositoryClass: AddressRepository
id:
id:
type: integer
autoincrement: true
generator:
strategy: AUTO
inheritanceType: SINGLE_TABLE
discriminatorColumn:
name: discr
type: string
length: 255
discriminatorMap:
customeraddress: Acme\MyBundle\Entity\Customeraddress
corporationaddress: Acme\MyBundle\Entity\Corporationaddress
fields:
...
Acme\MyBundle\Entity\Customeraddress:
type: entity
repositoryClass: CustomeraddressRepository
fields:
...
Acme\MyBundle\Entity\Corporationaddress:
type: entity
repositoryClass: CorporationaddressRepository
fields:
...
但我有一个错误:
Entity class 'Acme\MyBundle\Entity\Customeraddress' used in the discriminator map of class 'Acme\EdgarMainBundle\Entity\Address' does not exist.
是的,我可以自己创建,但是有办法用
来创建它doctrine:generate:entities MyBundle
命令?
答案 0 :(得分:0)
doctrine:generate:entities MyBundle
应改为
doctrine:generate:entities AcmeMyBundle
或
doctrine:generate:entities Acme/MyBundle
文档:http://symfony.com/doc/current/book/doctrine.html#generating-getters-and-setters