doctrine2 - Doctrine Many to Many join error -
i trying create many many join products categories tables in zf2 using doctrine 2.
in categories entity have
/** * @var \doctrine\orm\persistentcollection * * @orm\manytomany(targetentity="application\entity\products", inversedby="categories") * @orm\jointable(name="product_to_category", * joincolumns={@orm\joincolumn(name="category_id", referencedcolumnname="category_id")}, * inversejoincolumns={@orm\joincolumn(name="product_id", referencedcolumnname="product_id")} * ) */ private $products;
and in products entity have
/** * @var doctrine\orm\persistentcollection * * @orm\manytomany(targetentity="application\entity\categories", mappedby="products") */ private $categories;
but keep getting error fatal error: uncaught exception 'doctrine\orm\mapping\mappingexception' message 'the column category_id must mapped field in class application\entity\categories since referenced join column of class.' in c:\users\user\documents\my webs\freedomsnew\vendor\doctrine\orm\lib\doctrine\orm\mapping\mappingexception.php on line 328 when try lazy load data.
i'm not sure error trying tell me , cant see wrong!!
please can point me in right direction.
many in advance.
Comments
Post a Comment