Doctrine table class inheritance when one subclass has no extra attributes

前端 未结 5 1560
情歌与酒
情歌与酒 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条回答
  •  别跟我提以往
    2021-02-13 02:54

    Bit of a late response but it may be useful for others asking this question.

    Make the class 'AbstractAction' concrete and add a mapping for it in the discriminator map (You probably want to rename it at this point)

     * @DiscriminatorMap({"ABSTRACT" = "AbstractAction", "FOO" = "FooAction", "BAR" = "BarAction", ...})
     */
    class AbstractAction
    {

    You should then use that table for rows which need no additional columns

提交回复
热议问题