所以,有几个类似的问题围绕着SO,但它们最终没有帮助我.我一遍又一遍地检查我的代码,但我无法弄清楚错误.
当获取类别中的所有Comakers(OneToMany)时,我得到NULL而不是所需的数组.
在我的Comaker实体中,我有:
/**
* @ORM\ManyToOne(targetEntity="Category", inversedBy="comakers")
* @ORM\JoinColumn(name="categoryid", referencedColumnName="id")
*/
private $category;
接下来在我的Category类中:
/*
* @ORM\OneToMany(targetEntity="Comaker", mappedBy="category"
*/
private $comakers;
检查我的映射时得到的错误:
[Mapping]  FAIL - The entity-class 'Zoho\Bundle\Entity\Comaker' mapping is invalid:
* The association Zoho\Bundle\Entity\Comaker#category refers to the inverse side field Zoho\Bundle\Entity\Category#comakers which does not exist.
如果你问我,分类#comakers 确实存在!最重要的是,当生成实体时,教条也会为类别#comakers生成任何东西.缓存已被清除,甚至删除所有getter和setter以及Entity.php~文件以进行清理生成,但无济于事.
有谁知道发生了什么事?
Jav*_*vad 10
首先,您错过了关闭private $comakers;
Next 的括号,您需要更改/*为/**
/**
* @ORM\OneToMany(targetEntity="Comaker", mappedBy="category")
*/
private $comakers;
| 归档时间: | 
 | 
| 查看次数: | 4938 次 | 
| 最近记录: |