Sulu\Component\PHPCR\SessionManager\SessionManagerInterface::getRoutePath PHP Method

getRoutePath() public method

Returns the route path for given webspace.
public getRoutePath ( string $webspaceKey, string $languageCode, string $segment = null ) : string
$webspaceKey string
$languageCode string
$segment string
return string
    public function getRoutePath($webspaceKey, $languageCode, $segment = null);

Usage Example

Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $webspaceKey = $input->getArgument('webspaceKey');
     $locale = $input->getArgument('locale');
     $basePath = $input->getOption('base-path');
     $dryRun = $input->getOption('dry-run');
     $this->session = $this->getContainer()->get('doctrine_phpcr')->getManager()->getPhpcrSession();
     $this->sessionManager = $this->getContainer()->get('sulu.phpcr.session');
     $this->output = $output;
     $path = $this->sessionManager->getRoutePath($webspaceKey, $locale);
     $relativePath = $basePath !== null ? '/' . ltrim($basePath, '/') : '/';
     $fullPath = rtrim($path . $relativePath, '/');
     if (!$this->session->nodeExists($fullPath)) {
         $this->output->write('<error>Resource-Locator "' . $relativePath . '" not found</error>');
         return;
     }
     $node = $this->session->getNode($fullPath);
     $this->cleanup($node, $path, $dryRun);
     if (false === $dryRun) {
         $this->output->writeln('<info>Saving ...</info>');
         $this->session->save();
         $this->output->writeln('<info>Done</info>');
     } else {
         $this->output->writeln('<info>Dry run complete</info>');
     }
 }
All Usage Examples Of Sulu\Component\PHPCR\SessionManager\SessionManagerInterface::getRoutePath