【发布时间】:2016-01-02 15:12:24
【问题描述】:
我正在尝试定义一个OneToMany 双向(以避免ManyToMany 和额外的表),我正在做(我认为)正如文档所说的here 但我肯定错过了一些东西,因为我收到了这个错误运行doctrine:schema:validate 命令后:
关联PlatformBundle\Entity\Downloads#identifier是指不存在的拥有方字段PlatformBundle\Entity\Identifier#downloads。
这是实体的样子(只是相关字段):
class Identifier
{
/*
* @var Downloads
* @ORM\ManyToOne(targetEntity="Downloads", inversedBy="identifier")
* @ORM\JoinColumn(name="downloads_id", referencedColumnName="id")
*/
protected $downloads;
}
class Downloads
{
/**
* @var Collection
* @ORM\OneToMany(targetEntity="Identifier", mappedBy="downloads")
*/
protected $identifier;
public function __construct() {
$this->identifier = new ArrayCollection();
}
}
这是一个将下载分配给多个标识符的关联。我在这里做错了什么或遗漏了什么?
【问题讨论】:
-
尝试使用FQCN进行
targetEntity注解 -
@mblaettermann 没有变化,同样的结果,这很奇怪
标签: symfony doctrine-orm doctrine mapping