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?
原来我忘了在查询生成器上添加->join('myEntity.lastestStatus', 'lastestStatus')
子句...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.