When I set a ManytoOne mapping, while both class in same namespace, it works.
but it won't work if the two class are in different namespace?
/**
* @ORM\ManyToOne(targetEntity="OP\ProjectBundle\Entity\Project", inversedBy="tickets")
* @ORM\JoinColumn(name="project_id", referencedColumnName="id")
*/
protected $project;
You have to use the absolute namespace of your target entity - note the leading backspace in its name.
/**
* @ORM\ManyToOne(targetEntity="\OP\ProjectBundle\Entity\Project", inversedBy="tickets")
* @ORM\JoinColumn(name="project_id", referencedColumnName="id")
*/
protected $project;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With