private function upgradeNode(StructureBridge $page, Webspace $webspace, Localization $localization, OutputInterface $output, $depth = 0) { /** @var SessionManagerInterface $sessionManager */ $sessionManager = $this->getContainer()->get('sulu.phpcr.session'); $session = $sessionManager->getSession(); $node = $session->getNodeByIdentifier($page->getUuid()); /** @var RlpStrategyInterface $strategy */ $strategy = $this->getContainer()->get('sulu.content.rlp.strategy.tree'); /** @var ResourceLocator $resourceLocator */ $resourceLocator = $this->getContainer()->get('sulu.content.type.resource_locator'); if (!$page->hasTag('sulu.rlp')) { return; } $property = $page->getPropertyByTagName('sulu.rlp'); if ($property->getContentTypeName() !== 'resource_locator' && $page->getNodeType() !== Structure::NODE_TYPE_CONTENT) { return; } $transProperty = new TranslatedProperty($property, $localization->getLocalization(), $this->getContainer()->getParameter('sulu.content.language.namespace')); try { // load value $rl = $strategy->loadByContent($node, $webspace->getKey(), $localization->getLocalization()); // save value $property->setValue($rl); $resourceLocator->write($node, $transProperty, 1, $webspace->getKey(), $localization->getLocalization()); $session->save(); $prefix = ' '; for ($i = 0; $i < $depth; ++$i) { $prefix .= '-'; } $output->writeln($prefix . '> "' . $page->getPropertyValue('title') . '": ' . $rl); } catch (ResourceLocatorNotFoundException $ex) { } }