protected function saveObjects() { // Product information korábbi elemeinek törlése $oldItems = $this->object->getInformation()->toArray(); if ($oldItems) { foreach ($oldItems as $item) { $this->entityManager->remove($item); $this->object->removeInformation($item); } } // Product information-be új elemek hozzá adása if ($this->informationObjects) { foreach ($this->informationObjects as $item) { $this->object->addInformation($item); } } // Product persist $this->entityManager->persist($this->object); // Product information persistek if ($this->informationObjects) { foreach ($this->informationObjects as $object) { $this->entityManager->persist($object); } } //Flush $this->entityManager->flush(); }