2

我正在尝试使用具有YAML格式的Gedmo的扩展,但是当我尝试更新架构时,它返回以下错误:

[Gedmo\Exception\InvalidMappingException]
Unable to find ancestor/parent child relation through ancestor field - [parent] in class -

以下代码是MyEntity.orm.yml文件:

Project\MyBundle\Entity\MyEntity:
    type: entity
    repositoryClass: Gedmo\Tree\Entity\Repository\NestedTreeRepository
    gedmo:
        tree:
            type: nested
    id:
        id:
            type: string
            nullable: false
            generator:
                strategy: UUID
    fields:
        name:
            type: string
            length: 200
        locale:
            type: string
            length: 6
        lft:
            type: integer
            gedmo:
                - treeLeft
        lvl:
            type: integer
            gedmo:
                - treeLevel
        rgt:
            type: integer
            gedmo:
                - treeRight
        root:
            type: string
            nullable: true
            gedmo:
                - treeRoot

    manyToOne:
        parent:
            targetEntity: Project\MyBundle\Model\MyEntityInterface
            inversedBy: children
            joinColumn:
                name: parent_id
                referencedColumnName: id
                onDelete: CASCADE
            gedmo:
                - treeParent
    oneToMany:
        children:
            targetEntity: Project\MyBundle\Model\MyEntityInterface
            mappedBy: parent
            orderBy:
                lft: ASC
4

1 回答 1

1

不能是接口,必须是实体

寻找

目标实体:Project\MyBundle\Model\MyEntityInterface

改成:

目标实体:项目\MyBundle\Entity\MyEntity

于 2014-04-10T19:02:00.573 回答