Sulu\Component\Webspace\Manager\WebspaceManagerInterface::getWebspaceCollection PHP Method

getWebspaceCollection() public method

Returns all the webspaces managed by this specific instance.
public getWebspaceCollection ( ) : WebspaceCollection
return WebspaceCollection
    public function getWebspaceCollection();

Usage Example

Esempio n. 1
0
 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();
     }
 }
All Usage Examples Of Sulu\Component\Webspace\Manager\WebspaceManagerInterface::getWebspaceCollection