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


PHP SessionInterface::getWorkspace方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     $this->renewSession();
     // reset session
     parent::setUp();
     $this->workspace = $this->session->getWorkspace();
 }
开发者ID:laurentiuc,项目名称:phpcr-api-tests,代码行数:7,代码来源:NodeTypeBaseCase.php

示例2: move

 /**
  * @param string $moved_path
  * @param string $target_path
  *
  * @return array
  */
 public function move($moved_path, $target_path)
 {
     $resulting_path = $target_path . '/' . PathHelper::getNodeName($moved_path);
     $workspace = $this->session->getWorkspace();
     $workspace->move($moved_path, $target_path . '/' . PathHelper::getNodeName($moved_path));
     return array('id' => $resulting_path, 'url_safe_id' => ltrim($resulting_path, '/'));
 }
开发者ID:EmmanuelVella,项目名称:TreeBrowserBundle,代码行数:13,代码来源:PHPCRTree.php

示例3: __construct

 public function __construct(SessionManagerInterface $sessionManager, PropertyEncoder $propertyEncoder, WebspaceManagerInterface $webspaceManager, LocalizationFinderInterface $localizationFinder, SuluNodeHelper $nodeHelper)
 {
     $this->sessionManager = $sessionManager;
     $this->propertyEncoder = $propertyEncoder;
     $this->webspaceManager = $webspaceManager;
     $this->localizationFinder = $localizationFinder;
     $this->nodeHelper = $nodeHelper;
     $this->session = $sessionManager->getSession();
     $this->qomFactory = $this->session->getWorkspace()->getQueryManager()->getQOMFactory();
 }
开发者ID:ollietb,项目名称:sulu,代码行数:10,代码来源:ContentRepository.php

示例4: setUp

 public function setUp()
 {
     $this->session = $this->prophesize(SessionInterface::class);
     $this->workspace = $this->prophesize(WorkspaceInterface::class);
     $this->queryManager = $this->prophesize(QueryManagerInterface::class);
     $this->dispatcher = $this->prophesize(EventDispatcherInterface::class);
     $this->phpcrQuery = $this->prophesize(QueryInterface::class);
     $this->phpcrResult = $this->prophesize(QueryResultInterface::class);
     $this->queryCreateEvent = $this->prophesize(QueryCreateEvent::class);
     $this->queryExecuteEvent = $this->prophesize(QueryExecuteEvent::class);
     $this->query = $this->prophesize(Query::class);
     $this->subscriber = new QuerySubscriber($this->session->reveal(), $this->dispatcher->reveal());
     $this->session->getWorkspace()->willReturn($this->workspace->reveal());
     $this->workspace->getQueryManager()->willReturn($this->queryManager->reveal());
 }
开发者ID:hason,项目名称:sulu-document-manager,代码行数:15,代码来源:QuerySubscriberTest.php

示例5: up

 public function up(SessionInterface $session)
 {
     $workspace = $session->getWorkspace();
     $nodeTypeManager = $workspace->getNodeTypeManager();
     $nodeTypeManager->registerNodeType(new HomeNodeType(), true);
     $this->migrateHome($session, 'sulu:page', 'sulu:home', true);
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:7,代码来源:Version201504271608.php

示例6: transactional

 /**
  * {@inheritDoc}
  */
 public function transactional($callback)
 {
     if (!is_callable($callback)) {
         throw new InvalidArgumentException(sprintf('Parameter $callback must be a valid callable, "%s" given', gettype($callback)));
     }
     $transactionManager = null;
     try {
         $transactionManager = $this->session->getWorkspace()->getTransactionManager();
     } catch (UnsupportedRepositoryOperationException $e) {
         $result = call_user_func($callback, $this);
         $this->flush();
         return $result;
     }
     $transactionManager->begin();
     try {
         $result = call_user_func($callback, $this);
         $this->flush();
     } catch (\Exception $exception) {
         $this->close();
         $transactionManager->rollback();
         throw $exception;
     }
     $transactionManager->commit();
     return $result;
 }
开发者ID:pkdevbox,项目名称:phpcr-odm,代码行数:28,代码来源:DocumentManager.php

示例7: migrateExternalLinks

 private function migrateExternalLinks(SessionInterface $session, $directionUp = true)
 {
     $workspace = $session->getWorkspace();
     $queryManager = $workspace->getQueryManager();
     $webspaceManager = $this->container->get('sulu_core.webspace.webspace_manager');
     $propertyEncoder = $this->container->get('sulu_document_manager.property_encoder');
     $webspaces = $webspaceManager->getWebspaceCollection();
     /** @var Webspace $webspace */
     foreach ($webspaces as $webspace) {
         foreach ($webspace->getAllLocalizations() as $localization) {
             $locale = $localization->getLocalization();
             $query = $queryManager->createQuery(sprintf('SELECT * FROM [nt:base] WHERE [%s] = 4 AND [jcr:mixinTypes] = "sulu:page"', $propertyEncoder->localizedSystemName('nodeType', $locale)), 'JCR-SQL2');
             $rows = $query->execute();
             foreach ($rows as $row) {
                 /** @var NodeInterface $node */
                 $node = $row->getNode();
                 $templatePropertyName = $propertyEncoder->localizedSystemName('template', $locale);
                 try {
                     if (true === $directionUp) {
                         $node->setProperty($templatePropertyName, $webspace->getDefaultTemplate('page'));
                     } else {
                         $node->setProperty($templatePropertyName, 'external-link');
                     }
                 } catch (\Exception $e) {
                     echo $e->getMessage() . PHP_EOL;
                 }
             }
         }
     }
 }
开发者ID:sulu,项目名称:sulu,代码行数:30,代码来源:Version201507281529.php

示例8: iterateStructureNodes

 /**
  * Iterates over all nodes of the given type, and upgrades them.
  *
  * @param StructureMetadata $structureMetadata The structure metadata, whose pages have to be upgraded
  * @param array $properties The properties which are or contain URL fields
  * @param bool $addScheme Adds the scheme to URLs if true, removes the scheme otherwise
  */
 private function iterateStructureNodes(StructureMetadata $structureMetadata, array $properties, $addScheme)
 {
     foreach ($this->localizationManager->getLocalizations() as $localization) {
         $rows = $this->session->getWorkspace()->getQueryManager()->createQuery(sprintf('SELECT * FROM [nt:unstructured] WHERE [%s] = "%s" OR [%s] = "%s"', $this->propertyEncoder->localizedSystemName('template', $localization->getLocalization()), $structureMetadata->getName(), 'template', $structureMetadata->getName()), 'JCR-SQL2')->execute();
         foreach ($rows->getNodes() as $node) {
             $this->upgradeNode($node, $localization->getLocalization(), $properties, $addScheme);
         }
     }
 }
开发者ID:ollietb,项目名称:sulu,代码行数:16,代码来源:Version201511240844.php

示例9: copy

 /**
  * Copy the document with the given path or ID to the path
  * of the destination document (as a child).
  *
  * @param string $srcId
  * @param string $destId
  * @param string $name
  *
  * @return string
  */
 public function copy($srcId, $destId, $name)
 {
     $workspace = $this->session->getWorkspace();
     $srcPath = $this->normalizeToPath($srcId);
     $parentDestPath = $this->normalizeToPath($destId);
     $destPath = $parentDestPath . '/' . $name;
     $workspace->copy($srcPath, $destPath);
     return $destPath;
 }
开发者ID:hason,项目名称:sulu-document-manager,代码行数:19,代码来源:NodeManager.php

示例10: registerNodeTypes

    /**
     * Register the system node types on the given session.
     *
     * @param SessionInterface
     */
    public function registerNodeTypes(SessionInterface $session)
    {
        $cnd = <<<CND
// register phpcr_locale namespace
<{$this->localeNamespace}='{$this->localeNamespaceUri}'>
// register phpcr namespace
<{$this->phpcrNamespace}='{$this->phpcrNamespaceUri}'>
[phpcr:managed]
mixin
- phpcr:class (STRING)
- phpcr:classparents (STRING) multiple
CND;
        $nodeTypeManager = $session->getWorkspace()->getNodeTypeManager();
        $nodeTypeManager->registerNodeTypesCnd($cnd, true);
    }
开发者ID:doctrine,项目名称:phpcr-odm,代码行数:20,代码来源:NodeTypeRegistrator.php

示例11: registerNodeTypesCnd

 /**
  * Register node types with compact node definition format
  *
  * This is only a proxy to the transport
  *
  * @param  string  $cnd         a string with cnd information
  * @param  boolean $allowUpdate whether to fail if node already exists or to update it
  * @return bool    true on success
  */
 public function registerNodeTypesCnd($cnd, $allowUpdate)
 {
     if ($this->transport instanceof NodeTypeCndManagementInterface) {
         return $this->transport->registerNodeTypesCnd($cnd, $allowUpdate);
     }
     if ($this->transport instanceof NodeTypeManagementInterface) {
         $workspace = $this->session->getWorkspace();
         $nsRegistry = $workspace->getNamespaceRegistry();
         $parser = new CndParser($workspace->getNodeTypeManager());
         $res = $parser->parseString($cnd);
         $ns = $res['namespaces'];
         $types = $res['nodeTypes'];
         foreach ($ns as $prefix => $uri) {
             $nsRegistry->registerNamespace($prefix, $uri);
         }
         return $workspace->getNodeTypeManager()->registerNodeTypes($types, $allowUpdate);
     }
     throw new UnsupportedRepositoryOperationException('Transport does not support registering node types');
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:28,代码来源:ObjectManager.php

示例12: migrateInternalLinks

    private function migrateInternalLinks(SessionInterface $session, $directionUp = true)
    {
        $workspace = $session->getWorkspace();
        $queryManager = $workspace->getQueryManager();
        $webspaceManager = $this->container->get('sulu_core.webspace.webspace_manager');
        $propertyEncoder = $this->container->get('sulu_document_manager.property_encoder');
        $webspaces = $webspaceManager->getWebspaceCollection();
        foreach ($webspaces as $webspace) {
            foreach ($webspace->getAllLocalizations() as $localization) {
                $locale = $localization->getLocalization();
                $sql = <<<EOT
SELECT * FROM [nt:unstructured] WHERE %s = 2
EOT;
                $query = $queryManager->createQuery(sprintf($sql, '[' . $propertyEncoder->localizedSystemName('nodeType', $locale) . ']'), 'JCR-SQL2');
                $rows = $query->execute();
                foreach ($rows as $row) {
                    $node = $row->getNode();
                    $internalLinkName = $propertyEncoder->localizedSystemName('internal_link', $locale);
                    try {
                        if (true === $directionUp) {
                            $internalUuid = $node->getPropertyValue($internalLinkName);
                            $internalNode = $session->getNodeByIdentifier($internalUuid);
                            $node->setProperty($internalLinkName, null);
                            $node->setProperty($internalLinkName, $internalNode);
                        } else {
                            $internalNode = $node->getPropertyValue($internalLinkName);
                            $internalNodeUuid = $internalNode->getIdentifier();
                            $node->setProperty($internalLinkName, null);
                            $node->setProperty($internalLinkName, $internalNodeUuid);
                        }
                    } catch (\Exception $e) {
                        echo $e->getMessage() . PHP_EOL;
                    }
                }
            }
        }
    }
开发者ID:ollietb,项目名称:sulu,代码行数:37,代码来源:Version201504281842.php

示例13: createQueryBuilder

 /**
  * Create the fluent query builder.
  *
  * After building your query, use DocumentManager::getDocumentsByQuery with the
  * query returned by QueryBuilder::getQuery()
  *
  * @return QueryBuilder
  */
 public function createQueryBuilder()
 {
     $qm = $this->session->getWorkspace()->getQueryManager();
     return new QueryBuilder($qm->getQOMFactory());
 }
开发者ID:nicam,项目名称:phpcr-odm,代码行数:13,代码来源:DocumentManager.php

示例14: registerNodeTypes

 /**
  * Register the content-type node types with the given PHPCR session.
  */
 public function registerNodeTypes(SessionInterface $session)
 {
     $cnd = sprintf('<%s=\'https://github.com/symfony-cmf/content-type\'>', $this->encoder->getPrefix(), $this->encoder->getUri());
     $nodeTypeManager = $session->getWorkspace()->getNodeTypeManager();
     $nodeTypeManager->registerNodeTypesCnd($cnd, true);
 }
开发者ID:symfony-cmf,项目名称:content-type,代码行数:9,代码来源:NodeTypeRegistrator.php

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