protected function cloneComponent($data) { $entity = $data['entity']; $this->componentService->clearSection($data['place'], $entity, $data['section']); $newComponentId = $this->componentService->cloneComponentPlace($data['componentId'], $entity)->uniqName; foreach ($data['stack'] as &$item) { $item = $item == $data['componentId'] ? $newComponentId : $item; } $this->componentService->saveSectionPositionStack($entity, $data['section'], $data['stack']); $this->clearCache($data['place'], $entity); return $newComponentId; }