Doctrine orm 用条令2和YAML映射嵌套树

Doctrine orm 用条令2和YAML映射嵌套树,doctrine-orm,tree,doctrine,yaml,Doctrine Orm,Tree,Doctrine,Yaml,我们目前正在使用该模块实现一个嵌套树。我们相信我们已经正确地连接了所有的东西,但是当我们使用条令去刷新时,我们总是得到一个例外 SyntaxErrorException in AbstractMySQLDriver.php line 90: An exception occurred while executing 'INSERT INTO ProductTree (left, right, rootProductTreeID, level, componentPro

我们目前正在使用该模块实现一个嵌套树。我们相信我们已经正确地连接了所有的东西,但是当我们使用条令去刷新时,我们总是得到一个例外

SyntaxErrorException in AbstractMySQLDriver.php line 90: An exception         
occurred while executing 'INSERT INTO ProductTree (left, right,     
rootProductTreeID, level, componentProductComponentID) VALUES (?, ?, ?, 
?, ?)':

You have an error in your SQL syntax; check the manual that corresponds 
to your MySQL server version for the right syntax to use near 'left, 
right, rootProductTreeID, level, componentProductComponentID) VALUES (?, 
?' at line 1
我们正在使用的触发此问题的代码是

$productTree->setRootProductComponentID($productComponent->getID());
$productTree->setComponent($productComponent);

$em->persist($productTree); 
$em->flush();
我们的YAML映射看起来也是如此

OS\Domain\Entity\Products\ProductTree:
    type: entity
    repositoryClass: Gedmo\Tree\Entity\Repository\NestedTreeRepository
    table: ProductTree
    gedmo:
      tree:
        type: nested
    indexes:
        rootProductFK_idx:
            columns:
                - rootProductComponentID
        componentProductFK_idx:
            columns:
                - componentProductComponentID
    id:
        id:
            type: integer
            nullable: false
            options:
                unsigned: false
            id: true
            generator:
                strategy: IDENTITY
    fields:
        left:
            type: integer
            nullable: false
            options:
                unsigned: false
            gedmo:
              - treeLeft
        right:
            type: integer
            nullable: false
            options:
                unsigned: false
            gedmo:
              - treeRight
        rootProductTreeID:
            type: integer
            nullable: false
            options:
                unsigned: false
            gedmo:
              - treeRoot
        level:
            type: integer
            gedmo:
              - treeLevel
    manyToOne:
#        parent:
#            targetEntity: OS\Domain\Entity\Products\ProductComponent
#            inversedBy: children
#            joinColumn:
#              name: parentProductComponentID
#              referencedColumnName: id
#              onDelete: CASCADE
#            gedmo:
#              - treeParent
        root:
            targetEntity: OS\Domain\Entity\Products\ProductTree
            cascade: {  }
            fetch: LAZY
            mappedBy: null
            inversedBy: null
            joinColumns:
                rootProductTreeID:
                    referencedColumnName: id
            orphanRemoval: false
            gedmo:
              - treeParent
        component:
            targetEntity: OS\Domain\Entity\Products\ProductComponent
            cascade: {  }
            fetch: LAZY
            mappedBy: null
            inversedBy: null
            joinColumns:
                componentProductComponentID:
                    referencedColumnName: id
            orphanRemoval: false
    oneToMany:
      children:
        targetEntity: OS\Domain\Entity\Products\ProductComponent
        mappedBy: parent
        orderBy:
          left: ASC
    lifecycleCallbacks: {  }
我们的条令配置在树驱动程序中添加:

                  $metadataDriver = new MappingDriverChain();
                $configuredDriver = $this->createMetadataDriver($doctrineConfig, $metadataConfig);
                $treeDriver = $doctrineConfig->newDefaultAnnotationDriver(
                    '/vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity'
                );
                $metadataDriver->addDriver($configuredDriver,'OS');
                $metadataDriver->addDriver($treeDriver,'Gedmo');
                DoctrineExtensions::registerAbstractMappingIntoDriverChainORM($metadataDriver);
我们在创建条令实体管理器之前注册树侦听器:

                $eventManager->addEventSubscriber(new TreeListener());

            return EntityManager::create(config('doctrine.connection'), $doctrineConfig, $eventManager);

我们已经试了几个小时来把这个东西连接起来,但它总是在持久性上失败,我们找不到原因。我们已经对所有不同的元素进行了代码跟踪,但是我们看不到这个错误是从哪里来的。任何帮助都将不胜感激,或者我们如何使用YAML连接树的示例也将受到欢迎

我们发现在树映射文件中,我们必须将left:和right:列命名为lft:和rgt:,这与github存储库中用于yaml映射的示例相同

fields:
    lft: <----
        type: integer
        nullable: false
        options:
            unsigned: false
        gedmo:
          - treeLeft
    rgt: <-----
        type: integer
        nullable: false
        options:
            unsigned: false
        gedmo:
          - treeRight
字段:
lft: