Search code examples
phpsymfonydoctrine-ormsymfony-3.3

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:

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

Any ideas what's going on?


Solution

  • Because of this annotation:

    @ORM\ManyToOne(targetEntity="Script", inversedBy="feedback")
    

    You have a typo in your Script entity

    private $feebdack;
    

    should be

    private $feedback;