Symfony 如何使条令迁移为继承表生成适当的SQL?
我有两个实体Symfony 如何使条令迁移为继承表生成适当的SQL?,symfony,doctrine-orm,doctrine-migrations,class-table-inheritance,Symfony,Doctrine Orm,Doctrine Migrations,Class Table Inheritance,我有两个实体A和B,其中B扩展了A: /** * Fruit * * @ORM\Table( * name="fruits", * indexes={} * ) * @ORM\Entity * @ORM\InheritanceType("JOINED") * @ORM\DiscriminatorColumn(name="type", type="string") * @ORM\Di
A
和B
,其中B
扩展了A
:
/**
* Fruit
*
* @ORM\Table(
* name="fruits",
* indexes={}
* )
* @ORM\Entity
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="type", type="string")
* @ORM\DiscriminatorMap({
* "apple" = "Apple"
* })
*/
abstract class Fruit extends AbstractEntity
{
/**
* @var string
* @ORM\Column(type="string" ...)
*/
private $color;
}
/**
* Apple
*
* @ORM\Table(
* name="apples",
* indexes={}
* )
* @ORM\Entity
*/
class Apple extends Fruit
{
/**
* @var string
* @ORM\Column(type="string" ...)
*/
private $foo;
}
当我运行migrations
命令(例如$./bin/console原则:migrations:diff
)时,我希望它创建两个表,并在apples
中id
列上的外键
,引用fruit.id
。但这一参考资料不见了
如何进行条令迁移以定义从子表.id
到父表.id
的引用?还是通过手动编辑生成的SQL来自己完成此操作的唯一方法