Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 578
Bananaapple Avatar asked Dec 12 '25 06:12

Bananaapple


1 Answers

Because of this annotation:

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

You have a typo in your Script entity

private $feebdack;

should be

private $feedback;
like image 139
Mz1907 Avatar answered Dec 14 '25 21:12

Mz1907



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!