copyLanguage() public method

Copies the content from one node from one localization to the other.
public copyLanguage ( string $uuid, $userId, $webspaceKey, $srcLanguageCode, $destLanguageCodes ) : Sulu\Component\Content\Compat\StructureInterface
$uuid string
$userId
$webspaceKey
$srcLanguageCode
$destLanguageCodes
return Sulu\Component\Content\Compat\StructureInterface
コード例 #1
0
 private function copyNode($srcLocale, $destLocale, StructureInterface $structure, $overwrite = false)
 {
     if (!$overwrite) {
         $destStructure = $this->contentMapper->load($structure->getUuid(), null, $destLocale, true);
         if (!($destStructure->getType() && $destStructure->getType()->getName() === 'ghost')) {
             $this->output->writeln('<info>Processing aborted: </info>' . $structure->getNodeName() . ' <comment>(use overwrite option to force)</comment>');
             return;
         }
     }
     $this->contentMapper->copyLanguage($structure->getUuid(), $structure->getChanger(), null, $srcLocale, $destLocale, Structure::TYPE_SNIPPET);
     $this->output->writeln('<info>Processing: </info>' . $structure->getNodeName());
 }
コード例 #2
0
 private function copyNode($webspaceKey, $srcLocale, $destLocale, StructureInterface $structure, $overwrite = false)
 {
     if (!$overwrite) {
         $destStructure = $this->contentMapper->load($structure->getUuid(), $webspaceKey, $destLocale, true);
         if (!($destStructure->getType() && $destStructure->getType()->getName() === 'ghost')) {
             $this->output->writeln('<info>Processing aborted: </info>' . $structure->getPath() . ' <comment>(use overwrite option to force)</comment>');
             return;
         }
     }
     if ($structure->getType() && $structure->getType()->getName() === 'ghost') {
         $this->output->writeln('<info>Processing aborted: </info>' . $structure->getPath() . ' <comment>(source language does not exist)</comment>');
         return;
     }
     try {
         $this->contentMapper->copyLanguage($structure->getUuid(), $structure->getChanger(), $webspaceKey, $srcLocale, $destLocale);
         $this->output->writeln('<info>Processing: </info>' . $structure->getPath());
     } catch (ResourceLocatorAlreadyExistsException $e) {
         $this->output->writeln(sprintf('<info>Processing aborted: </info> %s <comment>Resource Locator "%s" already exists', $structure->getPath(), $structure->getResourceLocator()));
     }
 }