public function initialize(OutputInterface $output, $purge = false)
{
$nodeTypeManager = $this->sessionManager->getSession()->getWorkspace()->getNodeTypeManager();
foreach ([new CustomUrlNodeType(), new CustomUrlRouteNodeType()] as $nodeType) {
$nodeTypeManager->registerNodeType($nodeType, true);
}
/** @var Webspace $webspace */
foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
$itemsPath = $this->pathBuilder->build(['%base%', $webspace->getKey(), '%custom_urls%', '%custom_urls_items%']);
$routesPath = $this->pathBuilder->build(['%base%', $webspace->getKey(), '%custom_urls%', '%custom_urls_routes%']);
$output->writeln(sprintf(' <info>%s</info>:', $webspace->getName()));
if (true === $this->nodeManager->has($itemsPath)) {
$output->writeln(sprintf(' [ ] <info>items path:</info>: %s ', $itemsPath));
} else {
$output->writeln(sprintf(' [+] <info>items path:</info>: %s ', $itemsPath));
$this->nodeManager->createPath($itemsPath);
}
if (true === $this->nodeManager->has($routesPath)) {
$output->writeln(sprintf(' [ ] <info>items path:</info>: %s ', $routesPath));
} else {
$output->writeln(sprintf(' [+] <info>items path:</info>: %s ', $routesPath));
$this->nodeManager->createPath($routesPath);
}
$this->nodeManager->save();
}
}