Inheritance of entities in Symfony3

0

I am with a project in Symfony3 and in which I want to do inheritance between the entities by annotation yml. Would                          Property (Father), (Children) Housing and Garage

I have three yml files:

File 1

Ar\Soft\Alquileres\ModelBundle\Entity\Inmueble\Inmueble:
    type: entity
    table: null
    repositoryClass: Ar\Soft\Alquileres\ModelBundle\Repository\InmuebleRepository
    inheritanceType: SINGLE_TABLE
    discriminatorColumn:
        name: tipo
        type: string
    discriminatorMap:
        vivienda: Vivienda
        cochera: Cochera           
    id:
        id:
            type: integer
            id: true
            generator:
                strategy: AUTO
    fields:
        valorDeCompra:
            type: float
            nullable: true
            column: valor_de_compra
        fechaDeCompra:
            type: date
            nullable: true
            column: fecha_de_compra
        disponible:
            type: boolean
            nullable: false
            options:
                default: true
        numero:
            type: integer
            nullable: false
            column: numero
        superficie:
            type: decimal
            precision: 10
            scale: 0
            nullable: true        
    lifecycleCallbacks: {  }

File 2

Ar\Soft\Alquileres\ModelBundle\Entity\Inmueble\Vivienda:
    type: entity
    table: null
    repositoryClass: Ar\Soft\Alquileres\ModelBundle\Repository\ViviendaRepository                
    fields:
        patio:
            type: boolean
            nullable: false
            options:
                default: false
    lifecycleCallbacks: {  }

File 3

Ar\Soft\Alquileres\ModelBundle\Entity\Inmueble\Cochera:
    type: entity
    table: null
    repositoryClass: Ar\Soft\Alquileres\ModelBundle\Repository\CocheraRepository   
    fields:
        tipoDeTecho:
            type: integer
            column: tipo_de_techo
    lifecycleCallbacks: {  }

When running from the folder php console doctrine: generate: entities ModelBundle

I get an error in file 1 (Property) because you do not know Vivieda and Cochera when you try to analyze the field " discriminatorMap "

Thank you.

    
asked by guillo_beltra 15.03.2017 в 18:20
source

1 answer

0

Try to put in the descriminatorMap the namespace + name of the class of the classes to which you refer, that error tends to be for not being able to solve the data type.

I hope it's just that.

    
answered by 16.03.2017 в 09:30