当前位置: 首页>>代码示例>>PHP>>正文


PHP SessionInterface::nodeExists方法代码示例

本文整理汇总了PHP中PHPCR\SessionInterface::nodeExists方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionInterface::nodeExists方法的具体用法?PHP SessionInterface::nodeExists怎么用?PHP SessionInterface::nodeExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPCR\SessionInterface的用法示例。


在下文中一共展示了SessionInterface::nodeExists方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * {@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>');
     }
 }
开发者ID:ollietb,项目名称:sulu,代码行数:29,代码来源:CleanupHistoryCommand.php

示例2: match

 /**
  * {@inheritDoc}
  */
 public function match(EventInterface $event)
 {
     if (!$event->getPath()) {
         // Some events (like PERSIST) don't have a path
         return false;
     }
     // An event might have been raised for a node that does not exist anymore
     if (!$this->session->nodeExists($event->getPath())) {
         return false;
     }
     $node = $this->session->getNode($event->getPath());
     foreach ($this->nodeTypes as $type) {
         if ($node->isNodeType($type)) {
             return true;
         }
     }
     return false;
 }
开发者ID:ruflin,项目名称:jackalope,代码行数:21,代码来源:NodeTypeEventFilter.php

示例3: cloneFromImmediately

 /**
  * Implement the workspace clone method. It is dispatched immediately.
  *      http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.10%20Corresponding%20Nodes
  *      http://www.day.com/specs/jcr/2.0/10_Writing.html#10.8%20Cloning%20and%20Updating%20Nodes
  *
  * @param string  $srcWorkspace   the name of the workspace from which the copy is to be made.
  * @param string  $srcAbsPath     the path of the node to be cloned.
  * @param string  $destAbsPath    the location to which the node at srcAbsPath is to be cloned in this workspace.
  * @param boolean $removeExisting
  *
  * @throws \PHPCR\UnsupportedRepositoryOperationException
  * @throws \PHPCR\ItemExistsException
  *
  * @see Workspace::cloneFrom()
  */
 public function cloneFromImmediately($srcWorkspace, $srcAbsPath, $destAbsPath, $removeExisting)
 {
     if (!$this->transport instanceof WritingInterface) {
         throw new UnsupportedRepositoryOperationException('Transport does not support writing');
     }
     $srcAbsPath = PathHelper::normalizePath($srcAbsPath);
     $destAbsPath = PathHelper::normalizePath($destAbsPath, true);
     if (!$removeExisting && $this->session->nodeExists($destAbsPath)) {
         throw new ItemExistsException('Node already exists at destination and removeExisting is false');
     }
     $this->transport->cloneFrom($srcWorkspace, $srcAbsPath, $destAbsPath, $removeExisting);
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:27,代码来源:ObjectManager.php

示例4: copyNodeImmediately

 /**
  * Implement the workspace copy method. It is dispatched immediately.
  *
  * @param string $srcAbsPath the path of the node to be copied.
  * @param string $destAbsPath the location to which the node at srcAbsPath
  *      is to be copied in this workspace.
  * @param string $srcWorkspace the name of the workspace from which the
  *      copy is to be made.
  *
  * @return void
  *
  * @see Workspace::copy()
  */
 public function copyNodeImmediately($srcAbsPath, $destAbsPath, $srcWorkspace)
 {
     if (!$this->transport instanceof WritingInterface) {
         throw new UnsupportedRepositoryOperationException('Transport does not support writing');
     }
     $this->verifyAbsolutePath($srcAbsPath);
     $this->verifyAbsolutePath($destAbsPath);
     if ($this->session->nodeExists($destAbsPath)) {
         throw new ItemExistsException('Node already exists at destination (update-on-copy is currently not supported)');
         // to support this, we would have to update the local cache of nodes as well
     }
     $this->transport->copyNode($srcAbsPath, $destAbsPath, $srcWorkspace);
 }
开发者ID:ruflin,项目名称:jackalope,代码行数:26,代码来源:ObjectManager.php

示例5: unlock

 /**
  * {@inheritDoc}
  *
  * @api
  */
 public function unlock($absPath)
 {
     if (!$this->session->nodeExists($absPath)) {
         throw new PathNotFoundException("Unable to unlock unexisting node '{$absPath}'");
     }
     if (!array_key_exists($absPath, $this->locks)) {
         throw new LockException("Unable to find an active lock for the node '{$absPath}'");
     }
     $node = $this->session->getNode($absPath);
     $state = $node->getState();
     if ($state === Item::STATE_NEW || $state === Item::STATE_MODIFIED) {
         throw new InvalidItemStateException("Cannot unlock the non-clean node '{$absPath}': current state = {$state}");
     }
     $this->transport->unlock($absPath, $this->locks[$absPath]->getLockToken());
     $this->locks[$absPath]->setIsLive(false);
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:21,代码来源:LockManager.php

示例6: import

 /**
  * Imports workspace.
  *
  * @param SessionInterface $session
  * @param string $path
  * @param string $fileName
  */
 private function import(SessionInterface $session, $path, $fileName)
 {
     if ($session->nodeExists($path)) {
         $session->getNode($path)->remove();
         $session->save();
     }
     $session->importXML(PathHelper::getParentPath($path), $fileName, ImportUUIDBehaviorInterface::IMPORT_UUID_COLLISION_THROW);
     $session->save();
 }
开发者ID:nanbando,项目名称:jackrabbit,代码行数:16,代码来源:JackrabbitPlugin.php

示例7: cleanSession

 private function cleanSession(OutputInterface $output, SessionInterface $session, $path, $dryRun)
 {
     $sessionName = $session->getWorkspace()->getName();
     $output->writeln(sprintf('<info>Session</info> %s', $sessionName));
     if (!$session->nodeExists($path)) {
         $output->write(sprintf('<error>Resource-Locator "%s" not found in session "%s"</error>', $path, $sessionName));
         return;
     }
     $node = $session->getNode($path);
     $this->cleanup($output, $node, $path, $dryRun);
     $output->writeln('');
 }
开发者ID:sulu,项目名称:sulu,代码行数:12,代码来源:CleanupHistoryCommand.php


注:本文中的PHPCR\SessionInterface::nodeExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。