Symfony Mapping Error: "The mappings are inconsistent with each other" & "The association refers to the inverse side field which does not exist"
Symfony Mapping Error: "The mappings are inconsistent with each other" & "The association refers to the inverse side field which does not exist"
我有两个实体映射如下:
class ScriptFeedback
{
/**
* @ORM\ManyToOne(targetEntity="Script", inversedBy="feedback")
*/
private $script;
...
}
class Script
{
/**
* @ORM\OneToMany(targetEntity="ScriptFeedback", mappedBy="script")
*/
private $feebdack;
...
}
这行得通 - 我可以从中生成迁移,并且该网站完全按照我想要的方式工作,正确链接我的脚本及其在数据库中的反馈。
然而 - 当我 运行 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.
[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.
有什么想法吗?
因为这个注解:
@ORM\ManyToOne(targetEntity="Script", inversedBy="feedback")
您的脚本实体中有错字
private $feebdack;
应该是
private $feedback;
我有两个实体映射如下:
class ScriptFeedback
{
/**
* @ORM\ManyToOne(targetEntity="Script", inversedBy="feedback")
*/
private $script;
...
}
class Script
{
/**
* @ORM\OneToMany(targetEntity="ScriptFeedback", mappedBy="script")
*/
private $feebdack;
...
}
这行得通 - 我可以从中生成迁移,并且该网站完全按照我想要的方式工作,正确链接我的脚本及其在数据库中的反馈。
然而 - 当我 运行 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.
[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.
有什么想法吗?
因为这个注解:
@ORM\ManyToOne(targetEntity="Script", inversedBy="feedback")
您的脚本实体中有错字
private $feebdack;
应该是
private $feedback;