/**
* {@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>');
}
}