So I'm trying to make a one to one relationship in Symfony2 with Doctrine but I'm getting following error:
An exception has been thrown during the rendering of a template ("Could not resolve type of column "id" of class "IntoPeople\DatabaseBundle\Entity\Feedbackcycle"") in IntoPeopleDatabaseBundle:Feedbackcycle:index.html.twig at line 65.
I have two entities, Feedbackcycle and CDP. In Feedbackcycle i 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;
}
/**
* Get cdp
*
* @return \IntoPeople\DatabaseBundle\Entity\Cdp
*/
public function getCdp()
{
return $this->cdp;
}
And in CDP I 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;
}
/**
* Get feedbackcycle
*
* @return \IntoPeople\DatabaseBundle\Entity\Feedbackcycle
*/
public function getFeedbackcycle()
{
return $this->feedbackcycle;
}
So in my twig I can forexample do this:
{{ feedbackcycle.cdp.id }}
And that will work, or I can also do feedbackcycle.name ( any attribute ) and it will work. But when I do
{{ feedbackcycle.cdp.*ANOTHER ATTRIBUTE* }}
I will get the error.