") */ protected $collection = []; /** @Type("ArrayCollection") */ private $anotherCollection; public function __construct() { $this->collection[] = new CircularReferenceChild('child1', $this); $this->collection[] = new CircularReferenceChild('child2', $this); $this->anotherCollection = new ArrayCollection(); $this->anotherCollection->add(new CircularReferenceChild('child1', $this)); $this->anotherCollection->add(new CircularReferenceChild('child2', $this)); } /** @PostDeserialize */ private function afterDeserialization() { if (!$this->collection) { $this->collection = []; } foreach ($this->collection as $v) { $v->setParent($this); } if (!$this->anotherCollection) { $this->anotherCollection = new ArrayCollection(); } foreach ($this->anotherCollection as $v) { $v->setParent($this); } } }