The association refers to the inverse side field which does not exist. | Symfony2 / Doctrine2
doctrine-orm, php, symfony
Solution
First you missed to close the parenthesis for `private $comakers;` Next you need to change `/*` to `/**`
/**
* @ORM\OneToMany(targetEntity="Comaker", mappedBy="category")
*/
private $comakers;
Problem
So, there are a couple of similar issues around SO but they didn't help me in the end.. I've checked my code over and over again, but I can't figure out the error. When getting all Comakers in a category (OneToMany) I get NULL instead of the desired array. In my Comaker entity I have: ``` /** * @ORM\ManyToOne(targetEntity="Category", inversedBy="comakers") * @ORM\JoinColumn(name="categoryid", referencedColumnName="id") */ private $category; ``` Next in my Category class: ``` /* * @ORM\OneToMany(targetEntity="Comaker", mappedBy="category" */ private $comakers; ``` The error I get when checking my mapping: ``` [Mapping] FAIL - The entity-class 'Zoho\Bundle\Entity\Comaker' mapping is invalid: * The association Zoho\Bundle\Entity\Comaker#category refers to the inverse side field Zoho\Bundle\Entity\Category#comakers which does not exist. ``` If you ask me, Category#comakers does exist! On top of that, when generating entities, doctrine is nog generating anything for Category#comakers either. Cache has been cleared, even removed all getters and setters and Entity.php~ files for clean generation, but to no avail. Does anyone have any idea what is going on?