我正在尝试使用具有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