Single Table Inheritance and Yaml configuration

前端 未结 2 1377
醉梦人生
醉梦人生 2021-02-05 23:25

I want to use in my project Single Table Inheritance for symfony2/doctrine, but I can\'t find any working examples with yaml configuration for it. In official documentation ther

2条回答
  •  故里飘歌
    2021-02-05 23:45

    Okay built-in converter saves life.

    In order to save time this an example of inheritance converted into yaml :

    #file: Resources/config/doctrine/Person.orm.yml
    Person:
      type: entity
      table: null
      fields:
        id:
          type: integer
          id: true
          generator:
            strategy: AUTO
      inheritanceType: SINGLE_TABLE
      discriminatorColumn:
        name: discr
        type: string
        length: 255
      discriminatorMap:
        person: Person
        employee: Employee
      lifecycleCallbacks: {  }
    
    
    #file: Resources/config/doctrine/Employee.orm.yml
    Employee:
      type: entity
      table: null
      lifecycleCallbacks: {  }
    

提交回复
热议问题