简体   繁体   English

Symfony映射错误:“映射彼此不一致”和“关联是指不存在的反侧字段”

[英]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.

相关问题 “关联指的是反面域”&“映射与自身不一致” - “association refers to the inverse side field” & “mappings are inconsistent with self” 指不存在的反侧字段。 教义2 - refers to the inverse side field which does not exist. Doctrine2 Symfony2-关联是指不存在的拥有方 - Symfony2 - Association refers to the owning side which does not exist Symfony2-映射无效是指不存在的拥有方 - Symfony2 - Mapping is invalid refers to the owning side which does not exist 关联X指的是未被定义为关联的逆侧字段Y. - The association X refers to the inverse side field Y which is not defined as association Doctrine 和 Symfony2:关联是指不存在错误的反面 - Doctrine and Symfony2 : Association refers to inverse side that doesn't exist error 主义和Symfony2 ManyToMany:关联指不存在错误的反面 - Doctrine and Symfony2 ManyToMany: Association refers to inverse side that doesn't exist error Symfony - 映射彼此不一致 - Symfony - The mappings are inconsistent with each other Symfony / Doctrine“指的是不存在的拥有方字段” - 但属性存在于课堂中 - Symfony / Doctrine “refers to the owning side field which does not exist” - but property is present in class symfony映射错误:反向和拥有的side字段不存在 - 即使我在两个类中都声明了它们 - symfony mapping error : inverse and owning side field field doesnot exist - even though I declared them in both the classes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM