public function initialize() { if ($this->initialized) { return; } $unManaged = array(); if ($this->collection !== null) { $unManaged = $this->collection->toArray(); } $eTerms = $this->entityTerms->findEntities($this->vocabulary->getId(), $this->type, $this->identifier); $this->snapshot = $eTerms; $this->collection = new ArrayCollection($eTerms); $this->initialized = true; foreach ($unManaged as $term) { $this->add($term); } }
public function initialize() { if ($this->initialized) { return; } $previous = null; if ($this->entityTerm !== null) { $previous = $this->entityTerm; } $entityTerm = $this->entityTerms->findEntity($this->vocabulary->getId(), $this->type, $this->identifier); $this->snapshot = $entityTerm; $this->entityTerm = $entityTerm; $this->initialized = true; if ($previous !== null) { $this->setTerm($previous); } }