I have the following OneToOne
relation inside MyEntity
:
/**
* @ORM\OneToOne(targetEntity="StatusHistory")
* @ORM\JoinColumn(name="lastest_status_id", referencedColumnName="id")
*/
protected $lastestStatus;
The entity StatusHistory
works. The migrations:diff
command creates the files prefectly, and the database have the correct column.
The problem is, when I do die("c: " . $this->lastestStatus)
inside MyEntity
(trying to debug a getter), it returns Namespace\MyEntity
rather than Namespace\StatusHistory
.
What am I doing wrong?
Turns out I forgot to add the ->join('myEntity.lastestStatus', 'lastestStatus')
clause on the query builder...