1
我有兩個實體,提交和提交歷史。當我試圖從特定提交中獲取提交歷史記錄時,即使有更多條目,它也只返回一個。Symfony2和Doctrine - OneToMany只返回一個結果
任何想法爲什麼?
這裏是實體。
//Entity Submission
/**
* @ORM\OneToMany(targetEntity="SubmissionHistory", mappedBy="submission")
*/
protected $histories;
public function __construct()
{
$this->histories = new ArrayCollection();
}
/**
* Get histories
*
* @return Doctrine\Common\Collections\Collection
*/
public function getHistories()
{
return $this->histories;
}
然後,
//Entity SubmissionHistory
/**
* @ORM\ManyToOne(targetEntity="Submission", inversedBy="histories")
* @ORM\JoinColumn(name="hash_key", referencedColumnName="hash_key")
*/
protected $submission;
/**
* Get submission
*
* @return SciForum\Version2Bundle\Entity\Submission
*/
public function getSubmission()
{
return $this->submission;
}