Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.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
Php 原则:对多对一关系和组合主键使用同一列时未定义的索引_Php_Symfony_Doctrine Orm - Fatal编程技术网

Php 原则:对多对一关系和组合主键使用同一列时未定义的索引

Php 原则:对多对一关系和组合主键使用同一列时未定义的索引,php,symfony,doctrine-orm,Php,Symfony,Doctrine Orm,我有以下表格结构: 比赛(足球赛) 身份证 日期 得分(一场比赛有多个得分) 匹配 类型(中场休息、完成、处罚) 价值(3:2) 我对分数的yml如下: id: match: type: bigint associationKey: true column: Match columnDefinition: bigint(20) unsigned NOT NULL COMMENT '@fk/sd_Match/id' type

我有以下表格结构:

比赛(足球赛)

  • 身份证
  • 日期
得分(一场比赛有多个得分)

  • 匹配
  • 类型(中场休息、完成、处罚)
  • 价值(3:2)
我对分数的yml如下:

id:
    match:
      type: bigint
      associationKey: true
      column: Match
      columnDefinition: bigint(20) unsigned NOT NULL COMMENT '@fk/sd_Match/id'
    type:
      type: string
      length: 2
      options:
        fixed: true
以及两者之间的关系:

manyToOne:
    match:
      targetEntity: Entity\Match
      inversedBy: scores
      joinColumns:
        Match:
          referencedColumnName: id
问题是,当我查找时,findOneBy。。。我得到这个错误:

Notice: Undefined index: Match
 /var/www/libe/vendor/doctrine/orm/lib/Doctrine/ORM/Utility/IdentifierFlattener.php:92
 /var/www/libe/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:2501
 /var/www/libe/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:144
 /var/www/libe/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:69
 /var/www/libe/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php:147
 /var/www/libe/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:720
 /var/www/libe/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:196
在两种情况下使用同一列似乎是一个问题

我尝试从键中删除匹配项,问题是分数实体没有加载匹配项

那样的话,如果我 $score=$scoreRepo->findOneBy(标准); $score->getMatch()//返回null,即使在数据库中,两个表中都有行用于构建关系


有什么想法吗?提前谢谢

您没有名为Match的列。搜索大写/小写字母的问题,实际上我是这样做的。表中的列为“匹配”,但实体中的属性为“匹配”。这是一个旧结构BTW您没有名为Match的列。搜索大写/小写字母的问题,实际上我是这样做的。表中的列为“匹配”,但实体中的属性为“匹配”。这是一个旧的结构顺便说一句