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


PHP PHPCR\SessionInterface类代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: purgeWorkspace

 /**
  * Delete all content in the workspace this session is bound to.
  *
  * Remember to save the session after calling the purge method.
  *
  * Note that if you want to delete a node under your root node, you can just
  * use the remove method on that node. This method is just here to help you
  * because the implementation might add nodes like jcr:system to the root
  * node which you are not allowed to remove.
  *
  * @param SessionInterface $session the session to remove all children of
  *      the root node
  *
  * @see isSystemItem
  */
 public static function purgeWorkspace(SessionInterface $session)
 {
     $root = $session->getRootNode();
     /** @var $property PropertyInterface */
     foreach ($root->getProperties() as $property) {
         if (!self::isSystemItem($property)) {
             $property->remove();
         }
     }
     /** @var $node NodeInterface */
     foreach ($root->getNodes() as $node) {
         if (!self::isSystemItem($node)) {
             $node->remove();
         }
     }
 }
开发者ID:frogriotcom,项目名称:phpcr-utils,代码行数:31,代码来源:NodeHelper.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->contentMapper = $this->prophesize('Sulu\\Component\\Content\\Mapper\\ContentMapperInterface');
     $this->requestAnalyzer = $this->prophesize('Sulu\\Component\\Webspace\\Analyzer\\RequestAnalyzerInterface');
     $this->contentTypeManager = $this->prophesize('Sulu\\Component\\Content\\ContentTypeManagerInterface');
     $this->structureManager = $this->prophesize('Sulu\\Component\\Content\\Compat\\StructureManagerInterface');
     $this->sessionManager = $this->prophesize('Sulu\\Component\\PHPCR\\SessionManager\\SessionManagerInterface');
     $this->session = $this->prophesize('PHPCR\\SessionInterface');
     $this->node = $this->prophesize('PHPCR\\NodeInterface');
     $this->parentNode = $this->prophesize('PHPCR\\NodeInterface');
     $this->startPageNode = $this->prophesize('PHPCR\\NodeInterface');
     $webspace = new Webspace();
     $webspace->setKey('sulu_test');
     $locale = new Localization();
     $locale->setCountry('us');
     $locale->setLanguage('en');
     $this->requestAnalyzer->getWebspace()->willReturn($webspace);
     $this->requestAnalyzer->getCurrentLocalization()->willReturn($locale);
     $this->contentTypeManager->get('text_line')->willReturn(new TextLine(''));
     $this->sessionManager->getSession()->willReturn($this->session->reveal());
     $this->sessionManager->getContentNode('sulu_test')->willReturn($this->startPageNode->reveal());
     $this->session->getNodeByIdentifier('123-123-123')->willReturn($this->node->reveal());
     $this->session->getNodeByIdentifier('321-321-321')->willReturn($this->parentNode->reveal());
     $this->node->getIdentifier()->willReturn('123-123-123');
     $this->node->getParent()->willReturn($this->parentNode->reveal());
     $this->node->getDepth()->willReturn(4);
     $this->parentNode->getIdentifier()->willReturn('321-321-321');
     $this->parentNode->getDepth()->willReturn(3);
     $this->startPageNode->getDepth()->willReturn(3);
     $this->structureResolver = new StructureResolver($this->contentTypeManager->reveal(), $this->structureManager->reveal());
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:32,代码来源:ContentTwigExtensionTest.php

示例6: createNode

 protected function createNode($id, $username)
 {
     $repository = $this->getMockBuilder('Jackalope\\Repository')->disableOriginalConstructor()->getMock();
     $this->session->expects($this->any())->method('getRepository')->with()->will($this->returnValue($repository));
     $nodeData = array("jcr:primaryType" => "rep:root", "jcr:system" => array(), 'username' => $username);
     return new Node($this->factory, $nodeData, $id, $this->session, $this->objectManager);
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:7,代码来源:UnitOfWorkTest.php

示例7: testCommand

 public function testCommand()
 {
     $this->converter->expects($this->once())->method('convert')->with('Document\\MyClass', array('en'), array(), 'none')->will($this->returnValue(false));
     $this->mockSession->expects($this->once())->method('save');
     $this->commandTester->execute(array('classname' => 'Document\\MyClass', '--locales' => array('en'), '--force' => true));
     $this->assertEquals('.' . PHP_EOL . 'done' . PHP_EOL, $this->commandTester->getDisplay());
 }
开发者ID:doctrine,项目名称:phpcr-odm,代码行数:7,代码来源:DocumentConvertTranslationCommandTest.php

示例8: 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

示例9: setUp

 public function setUp()
 {
     $this->factory = $this->getMock('Jackalope\\FactoryInterface');
     $this->session = $this->getSessionMock();
     $this->session->expects($this->any())->method('getNodes')->will($this->returnValue(array()));
     $this->session->expects($this->any())->method('getNodesByIdentifier')->will($this->returnValue(array()));
     $this->eventFilter = new EventFilter($this->factory, $this->session);
 }
开发者ID:frogriotcom,项目名称:jackalope,代码行数:8,代码来源:EventFilterTestCase.php

示例10: getNode

 /**
  * {@inheritDoc}
  */
 protected function getNode(array $pathSegments)
 {
     $absPath = '/' . implode('/', $pathSegments);
     try {
         return $this->session->getNode($absPath);
     } catch (\PHPCR\PathNotFoundException $e) {
         return null;
     }
 }
开发者ID:frogriotcom,项目名称:glob,代码行数:12,代码来源:PhpcrTraversalFinder.php

示例11: __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

示例12: upgradeLocale

 private function upgradeLocale(Webspace $webspace, Localization $localization, OutputInterface $output)
 {
     $output->writeln('  > Upgrade Locale: ' . $localization->getLocalization('-'));
     $contentNode = $this->liveSession->getNode($this->sessionManager->getContentPath($webspace->getKey()));
     $this->upgradeNode($contentNode, $webspace, $localization, $output);
     $this->upgradeByParent($contentNode, $webspace, $localization, $output);
 }
开发者ID:sulu,项目名称:sulu,代码行数:7,代码来源:MaintainResourceLocatorCommand.php

示例13: initPages

 private function initPages()
 {
     $this->team = $this->savePage('simple', ['title' => 'Team', 'url' => '/team'], $this->session->getNode('/cmf/sulu_io/contents')->getIdentifier());
     $this->johannes = $this->savePage('simple', ['title' => 'Johannes', 'url' => '/team/johannes'], $this->team->getUuid(), [$this->tag1->getId()]);
     $this->daniel = $this->savePage('simple', ['title' => 'Daniel', 'url' => '/team/daniel'], $this->team->getUuid());
     $this->thomas = $this->savePage('simple', ['title' => 'Thomas', 'url' => '/team/thomas'], $this->team->getUuid());
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:7,代码来源:SmartContentItemControllerTest.php

示例14: 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

示例15: skipIfNotSupported

 /**
  * Check whether the repository supports this descriptor and skip the test if it is not supported.
  *
  * @param string $descriptor
  *
  * @return bool True if the test can be done. Otherwise the test is skipped.
  */
 protected function skipIfNotSupported($descriptor)
 {
     if (false === $this->session->getRepository()->getDescriptor($descriptor)) {
         $this->markTestSkipped('Descriptor "' . $descriptor . '" not supported');
     }
     return true;
 }
开发者ID:laurentiuc,项目名称:phpcr-api-tests,代码行数:14,代码来源:BaseCase.php


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