[FLOW3-general] Doctrine ArrayCollection/PersistentCollection
Heiko Kromm | Paints
h.kromm at paints.de
Fri May 6 17:17:05 CEST 2011
Hi list,
I've a problem with my model properties of type \Doctrine\Common\Collections\ArrayCollection.
When I use my getter the returned value is of type \Doctrine\ORM\PersistentCollection and therefore I can't use the ArrayCollection functions on my returned value.
In my model I've my property:
/**
* @var \Doctrine\Common\Collections\ArrayCollection<\F3\Test\Domain\Model\Job\JobHint>
* @OneToMany(mappedBy="job", cascade={"all"}, orphanRemoval="true")
* @OrderBy({"sortOrder" = "ASC"})
*/
protected $jobhints;
I use the constructor to initalize the property as \Doctrine\Common\Collections\ArrayCollection.
public function __construct() {
$this->jobhints = new \Doctrine\Common\Collections\ArrayCollection();
}
But in my getter the property is of type \Doctrine\ORM\PersistentCollection
/**
* Returns the jobhints of this job
*
* @return \Doctrine\Common\Collections\ArrayCollection<\F3\Test\Domain\Model\Job\JobHint>
*/
public function getJobHints() {
\F3\var_dump(get_class($this->jobhints));
return clone $this->jobhints;
}
I'm totaly new to Doctrine and need some help at this point.
Thanks a lot
Heiko
More information about the FLOW3-general
mailing list