Sulu\Component\PHPCR\SessionManager\SessionManagerInterface::getSession PHP Метод

getSession() публичный Метод

Returns a valid session to interact with a phpcr database.
Устаревший: Use the doctrine_phpcr service to retrieve the session
public getSession ( ) : PHPCR\SessionInterface
Результат PHPCR\SessionInterface
    public function getSession();

Usage Example

Пример #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\PHPCR\SessionManager\SessionManagerInterface::getSession