[英]Symfony Mapping Error: “The mappings are inconsistent with each other” & “The association refers to the inverse side field which does not exist”
I got two entities mapped as follows: 我得到了两个映射如下的实体:
class ScriptFeedback
{
/**
* @ORM\ManyToOne(targetEntity="Script", inversedBy="feedback")
*/
private $script;
...
}
class Script
{
/**
* @ORM\OneToMany(targetEntity="ScriptFeedback", mappedBy="script")
*/
private $feebdack;
...
}
This works - I can generate migrations from this and the site works exactly how I want it to, correctly linking my scripts and their feedback in the DB. 这行得通-我可以据此生成迁移,并且站点可以按我希望的方式正常工作,可以在数据库中正确链接我的脚本及其反馈。
However - when I run doctrine:schema:validate
I get: 但是-当我运行doctrine:schema:validate
我得到:
[Mapping] FAIL - The entity-class 'AppBundle\\Entity\\Script' mapping is invalid: * The mappings AppBundle\\Entity\\Script#feebdack and AppBundle\\Entity\\ScriptFeedback#script are inconsistent with each other. [映射]失败-实体类“ AppBundle \\ Entity \\ Script”的映射无效:*映射AppBundle \\ Entity \\ Script#feebdack和AppBundle \\ Entity \\ ScriptFeedback#script相互不一致。
[Mapping] FAIL - The entity-class 'AppBundle\\Entity\\ScriptFeedback' mapping is invalid: * The association AppBundle\\Entity\\ScriptFeedback#script refers to the inverse side field AppBundle\\Entity\\Script#feedback which does not exist. [映射]失败-实体类'AppBundle \\ Entity \\ ScriptFeedback'映射无效:*关联AppBundle \\ Entity \\ ScriptFeedback#script引用的反向字段AppBundle \\ Entity \\ Script#feedback不存在。
Any ideas what's going on? 有什么想法吗?
Because of this annotation: 由于此注释:
@ORM\ManyToOne(targetEntity="Script", inversedBy="feedback")
You have a typo in your Script entity 您的脚本实体中有错字
private $feebdack;
should be 应该
private $feedback;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.