Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony 条令多个定义不起作用未定义索引:joinTable_Symfony_Doctrine Orm - Fatal编程技术网

Symfony 条令多个定义不起作用未定义索引:joinTable

Symfony 条令多个定义不起作用未定义索引:joinTable,symfony,doctrine-orm,Symfony,Doctrine Orm,我正在尝试在Symfony 3.2.6/PHP7.1上实现许多双向映射。我拿不到票 php bin/console doctrine:schema:update --dump-sql 命令运行时不会出现错误 [Symfony\Component\Debug\Exception\ContextErrorException] 注意:未定义索引:joinTable 定义如下: Busybee\StudentBundle\Entity\Student: type: entity ta

我正在尝试在Symfony 3.2.6/PHP7.1上实现许多双向映射。我拿不到票

php bin/console doctrine:schema:update --dump-sql 
命令运行时不会出现错误

[Symfony\Component\Debug\Exception\ContextErrorException] 注意:未定义索引:joinTable

定义如下:

Busybee\StudentBundle\Entity\Student:
    type: entity
    table: student
    repositoryClass: Busybee\StudentBundle\Repository\StudentRepository
    id:
        id:
            type: integer
            id: true
            generator:
                strategy: AUTO
    fields:
        startAtSchool:
            type: date
    manyToMany:
        enrolments:
            targetEntity: Busybee\StudentBundle\Entity\Enrolment
            mappedBy: students

如果我删除学生实体中的mappedBy,SQL将使用条令:schema:update命令生成。处的示例显示inversedBy实体上的joinTable索引,将joinTable添加到此实体或mappedBy实体仍会生成错误未定义索引:joinTable

那么,如果我做错了什么呢?这是虫子吗?非常感谢您的帮助


克雷格

我在这里发现了问题。这不是一个条令问题,而是我为添加表前缀而编写的订户。我已经更新了表前缀订阅服务器的代码,以便在定义为多个关联时正确捕获,并忽略非拥有方。我现在使用的是Doctrine网站上的表前缀代码


克雷格。

我在这里发现了问题。这不是一个条令问题,而是我为添加表前缀而编写的订户。我已经更新了表前缀订阅服务器的代码,以便在定义为多个关联时正确捕获,并忽略非拥有方。我现在使用的是Doctrine网站上的表前缀代码


Craig.

您是否删除/重新创建了您的数据库?如果您有一个现有的数据库,然后添加/修改了这些实体的结构,那么您可能在修改中遇到了一个错误。这通常可以通过重新开始来解决。显然,您不希望在生产站点上执行此操作!!谢谢你的评论。是,已删除所有表,故障依然存在。是否已删除/重新创建数据库?如果您有一个现有的数据库,然后添加/修改了这些实体的结构,那么您可能在修改中遇到了一个错误。这通常可以通过重新开始来解决。显然,您不希望在生产站点上执行此操作!!谢谢你的评论。是,已删除所有表,故障依然存在。
Busybee\StudentBundle\Entity\Enrolment:
    type: entity
    table: enrolment
    repositoryClass: Busybee\StudentBundle\Repository\EnrolmentRepository
    id:
        id:
            type: integer
            id: true
            generator:
                strategy: AUTO
    fields:
        status:
            type: string
            length: '32'
        lastModified:
            type: datetime
        createdOn:
            type: datetime
    manyToMany:
        students:
            targetEntity: Busybee\StudentBundle\Entity\Student
            inversedBy: enrolments