Расширение дерева Gedmo: невозможно найти отношение предок/родитель-потомок

Я пытаюсь использовать расширение tree для Gedmo с форматом YAML, но когда я пытаюсь обновить схему, возникает следующая ошибка:

[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

person Community    schedule 10.04.2014    source источник


Ответы (1)


Это не может быть интерфейс, это должна быть сущность

найти

targetEntity: Проект\MyBundle\Model\MyEntityInterface

изменить на:

targetEntity: Проект\MyBundle\Entity\MyEntity

person jamek    schedule 10.04.2014