protected function exportNode($position, Domain $domain, Node $node, ExportPointer $exportPointer) { $data = $node->toArray(TableMap::TYPE_CAMELNAME); if (!$node->getUrn()) { return; } $path = $node->getUrn(); $exportPointer->pushPath($path); if ($node->getId() === $domain->getStartnodeId()) { $domain->setVirtualColumn('startnodePath', $path); } $nodeData = $this->clearData($data, ['id', 'lft', 'rgt', 'lvl', 'pid', 'urn', 'domainId'], ['type' => 0, 'layout' => 'default', 'visible' => true]); $nodeData['sort'] = $position; $contents = $node->getContents(); $contentsData = []; foreach ($contents as $content) { $contentData = $content->toArray(TableMap::TYPE_CAMELNAME); $jsonDecoded = json_decode($contentData['content'], true); if (JSON_ERROR_NONE === json_last_error()) { $contentData['content'] = $jsonDecoded; } $contentData = $this->clearData($contentData, ['id', 'nodeId'], ['template' => 'JarvesBundle:Default:content.html.twig', 'type' => 'text']); $contentsData[] = $contentData; } $nodeData['contents'] = $contentsData; $exportPointer->addData($nodeData, '.yml'); foreach ($node->getChildren() as $idx => $child) { $this->exportNode($idx, $domain, $child, $exportPointer); } $exportPointer->popPath(); }