php - Symfony2 Doctrine one to one mapping -
so i'm trying make 1 one relationship in symfony2 doctrine i'm getting following error:
an exception has been thrown during rendering of template ("could not resolve type of column "id" of class "intopeople\databasebundle\entity\feedbackcycle"") in intopeopledatabasebundle:feedbackcycle:index.html.twig @ line 65.
i have 2 entities, feedbackcycle , cdp. in feedbackcycle have:
/** * @var \intopeople\databasebundle\entity\cdp * * @orm\onetoone(targetentity="intopeople\databasebundle\entity\cdp", inversedby="feedbackcycle") * @orm\joincolumns({ * @orm\joincolumn(name="cdpid", referencedcolumnname="id") * }) */ private $cdp; /** * set cdp * * @param \intopeople\databasebundle\entity\cdp $cdp * * @return feedbackcycle */ public function setcdp(\intopeople\databasebundle\entity\cdp $cdp = null) { $this->cdp = $cdp; return $this; } /** * cdp * * @return \intopeople\databasebundle\entity\cdp */ public function getcdp() { return $this->cdp; }
and in cdp have:
/** * @orm\onetoone(targetentity="feedbackcycle") */ protected $feedbackcycle; /** * set feedbackcycle * * @param \intopeople\databasebundle\entity\feedbackcycle $feedbackcycle * * @return cdp */ public function setfeedbackcycle(\intopeople\databasebundle\entity\feedbackcycle $feedbackcycle = null) { $this->feedbackcycle = $feedbackcycle; return $this; } /** * feedbackcycle * * @return \intopeople\databasebundle\entity\feedbackcycle */ public function getfeedbackcycle() { return $this->feedbackcycle; }
so in twig can forexample this:
{{ feedbackcycle.cdp.id }}
and work, or can feedbackcycle.name ( attribute ) , work. when
{{ feedbackcycle.cdp.*another attribute* }}
i error.
solved, forgot write mappedby in cdp:
/** * @orm\onetoone(targetentity="feedbackcycle", mappedby="cdp") */ protected $feedbackcycle;
Comments
Post a Comment