使用YML ContextErrorException生成Doctrine2实体

时间:2015-11-23 08:38:28

标签: php symfony doctrine-orm

我在Doctrine2和YML(* .orm.yml)文件中遇到实体生成问题。模式文件用于生成一组在它们之间具有一对多关系的实体 但是,在使用php app/console doctrine:generate:entities BundleName时,会引发以下错误:[Symfony\Component\Debug\Exception\ContextErrorException] Warning: Illegal string offset 'strategy'。要创建的某些实体包含要自动生成的ID(int)字段(参见下文)。您可能会发现here错误的完整堆栈跟踪

Agape\AgapeEPSBundle\Entity\Parent:
    type: entity
    table: parent
    id:
        id:
            type: int
            generator:
                strategy: AUTO
    fields:
        nom:
            type: string
            length: 250
            nullable: false
        prenoms:
            type: string
            length: 255
            nullable: false
        date_de_naiss:
            type: date
        telephone:
            type: string
            length: 250
            nullable: false     
        email:
            type: string
            length: 250
        date_of_creation:
            type: datetime
            nullable: false
    manyToOne:
        etablissement:
            targetEntity: etablissement
            inversedBy: parents
<!-- Typo here !! -->
            joinColumn:
                name: etablissement_id
                referencedColumnName: rne
    oneToMany:
        candidats:
            targetEntity: candidat
            mappedBy: parent   

1 个答案:

答案 0 :(得分:0)

type: int
generator:
trategy: AUTO

此行必须对齐