Doctrine table class inheritance when one subclass has no extra attributes

前端 未结 5 1556
情歌与酒
情歌与酒 2021-02-13 02:31

I\'m having a problem with my mapping. I can\'t get it to work. I have an abstract base class like so:

/**
 * @Entity
 * @Table(name=\"actions\")
 * @Inheritance         


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 03:10

    You are using joined inheritance model (class table inheritance), which uses a separate table for parent and each child. If you don't specify any fields in the child class, Doctrine will just create a table only containing ID field.

    And a parent class can only use one type of inheritance, either class table inheritance or single table inheritance.

    In that case, if you don't want to have a table with only id column in it, you need to change your data model.

提交回复
热议问题