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


PHP SessionInterface::save方法代码示例

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


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

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var Webspace $webspace */
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         $this->upgradeWebspace($webspace, $output);
     }
     $this->liveSession->save();
 }
开发者ID:sulu,项目名称:sulu,代码行数:8,代码来源:MaintainResourceLocatorCommand.php

示例3: handleSession

 private function handleSession(SessionInterface $session, $fileName)
 {
     if ($session->getRootNode()->hasNode('cmf')) {
         $session->getNode('/cmf')->remove();
         $session->save();
     }
     $session->importXML('/', $fileName, ImportUUIDBehaviorInterface::IMPORT_UUID_COLLISION_THROW);
     $session->save();
 }
开发者ID:sulu,项目名称:sulu,代码行数:9,代码来源:PHPCRImporter.php

示例4: testRemove

 public function testRemove()
 {
     $this->property->expects($this->any())->method('getName')->will($this->returnValue('i18n:de-hotels'));
     $pageNode = $this->session->getNode('/cmf/sulu_io/contents/hotels');
     $this->contentType->remove($pageNode, $this->property, 'sulu_io', 'de', null);
     $this->session->save();
     $this->assertFalse($pageNode->hasProperty('i18n:de-hotels'));
 }
开发者ID:jimblizz,项目名称:sulu,代码行数:8,代码来源:SnippetContentTest.php

示例5: removeTestNode

 protected function removeTestNode()
 {
     $root = $this->session->getRootNode();
     if ($root->hasNode($this->testNodeName)) {
         $root->getNode($this->testNodeName)->remove();
         $this->session->save();
     }
 }
开发者ID:pkdevbox,项目名称:phpcr-odm,代码行数:8,代码来源:ChildTranslationStrategyTest.php

示例6: testDelete

 public function testDelete()
 {
     $structure = $this->prepareHistoryTestData();
     $this->repository->delete('/test', 'sulu_io', 'en');
     $this->session->save();
     $result = $this->repository->getHistory($structure->getUuid(), 'sulu_io', 'en');
     $this->assertEquals(1, count($result['_embedded']['resourcelocators']));
     $this->assertEquals('/test-1', $result['_embedded']['resourcelocators'][0]['resourceLocator']);
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:9,代码来源:ResourceLocatorRepositoryTest.php

示例7: removeTestNode

 /**
  * Remove a PHPCR node under the root node
  *
  * @param string $name The name of the node to remove
  *
  * @return void
  */
 protected function removeTestNode($name)
 {
     $root = $this->session->getNode('/');
     if ($root->hasNode($name)) {
         $root->getNode($name)->remove();
         $this->session->save();
         $this->dm->clear();
     }
 }
开发者ID:steffenbrem,项目名称:phpcr-odm,代码行数:16,代码来源:AnnotationsTest.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');
     $path = $this->sessionManager->getRoutePath($webspaceKey, $locale);
     $relativePath = $basePath !== null ? '/' . ltrim($basePath, '/') : '/';
     $fullPath = rtrim($path . $relativePath, '/');
     $this->cleanSession($output, $this->defaultSession, $fullPath, $dryRun);
     $this->cleanSession($output, $this->liveSession, $fullPath, $dryRun);
     if (false === $dryRun) {
         $this->defaultSession->save();
         $this->liveSession->save();
         $output->writeln('<info>Save complete</info>');
     } else {
         $output->writeln('<info>Dry run complete</info>');
     }
 }
开发者ID:sulu,项目名称:sulu,代码行数:22,代码来源:CleanupHistoryCommand.php

示例9: testFindByUUID

 public function testFindByUUID()
 {
     $this->doc->topic = 'Un autre sujet';
     $this->doc->locale = 'fr';
     $this->dm->persist($this->doc);
     $this->dm->flush();
     $node = $this->session->getNode('/functional/' . $this->testNodeName);
     $node->addMixin('mix:referenceable');
     $this->session->save();
     $this->document = $this->dm->findTranslation($this->class, $node->getIdentifier(), 'fr');
     $this->assertInstanceOf($this->class, $this->document);
 }
开发者ID:steffenbrem,项目名称:phpcr-odm,代码行数:12,代码来源:DocumentManagerTest.php

示例10: build

 /**
  * {@inheritdoc}
  */
 public function build()
 {
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         $contentPath = $this->sessionManager->getContentPath($webspace->getKey());
         $this->context->getOutput()->writeln('Default workspace');
         $this->traverse($this->defaultSession->getNode($contentPath));
         $this->context->getOutput()->writeln('');
         $this->context->getOutput()->writeln('Live workspace');
         $this->traverse($this->liveSession->getNode($contentPath));
     }
     $this->defaultSession->save();
     $this->liveSession->save();
 }
开发者ID:sulu,项目名称:sulu,代码行数:16,代码来源:NodeOrderBuilder.php

示例11: testFindWithInternalLinkToItself

 public function testFindWithInternalLinkToItself()
 {
     $this->initPhpcr();
     $link = $this->createPage('test-1', 'de');
     $page = $this->createInternalLinkPage('test-2', 'de', $link);
     $node = $this->session->getNodeByIdentifier($page->getUuid());
     $node->setProperty('i18n:de-internal_link', $node);
     $this->session->save();
     // should load content with requested node and not try to follow internal link
     $result = $this->contentRepository->find($page->getUuid(), 'de', 'sulu_io', MappingBuilder::create()->addProperties(['title'])->getMapping());
     $this->assertEquals($page->getUuid(), $result->getId());
     $this->assertEquals('/test-2', $result->getPath());
     $this->assertEquals('test-2', $result['title']);
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:14,代码来源:ContentRepositoryTest.php

示例12: migrateHome

 private function migrateHome(SessionInterface $session, $from, $to, $referenceWebspace)
 {
     $webspaceManager = $this->container->get('sulu_core.webspace.webspace_manager');
     $pathRegistry = $this->container->get('sulu_document_manager.path_segment_registry');
     $webspaces = $webspaceManager->getWebspaceCollection();
     foreach ($webspaces as $webspace) {
         $webspacePath = sprintf('/%s/%s', $pathRegistry->getPathSegment('base'), $webspace->getKey());
         $homeNodeName = $pathRegistry->getPathSegment('content');
         $webspace = $session->getNode($webspacePath);
         if ($referenceWebspace) {
             $webspace->addMixin('mix:referenceable');
         } else {
             $webspace->removeMixin('mix:referenceable');
         }
         $homeNode = $webspace->getNode($homeNodeName);
         $tmpNode = $session->getRootNode()->addNode('/tmp');
         $tmpNode->addMixin('mix:referenceable');
         $session->save();
         $homeNodeReferences = $homeNode->getReferences();
         $homeNodeReferenceValues = [];
         foreach ($homeNodeReferences as $homeNodeReference) {
             /* @var Property $homeNodeReference */
             $homeNodeReferenceValues[$homeNodeReference->getPath()] = $homeNodeReference->getValue();
             $homeNodeReference->setValue($tmpNode);
         }
         $session->save();
         $homeNode->removeMixin($from);
         $session->save();
         $homeNode->addMixin($to);
         $session->save();
         foreach ($homeNodeReferences as $homeNodeReference) {
             $homeNodeReference->setValue($homeNodeReferenceValues[$homeNodeReference->getPath()], PropertyType::REFERENCE);
         }
         $session->save();
         $tmpNode->remove();
     }
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:37,代码来源:Version201504271608.php

示例13: iterateStructures

 /**
  * Structures are updated according to their xml definition.
  *
  * @param bool $up Indicates that this is up or down
  */
 private function iterateStructures($up)
 {
     $properties = [];
     // find templates containing date fields
     $structureMetadatas = array_merge($this->structureMetadataFactory->getStructures('page'), $this->structureMetadataFactory->getStructures('snippet'));
     $structureMetadatas = array_filter($structureMetadatas, function (StructureMetadata $structureMetadata) use(&$properties) {
         $structureName = $structureMetadata->getName();
         $this->findDateProperties($structureMetadata, $properties);
         return !empty($properties[$structureName]) || !empty($blockProperties[$structureName]);
     });
     foreach ($structureMetadatas as $structureMetadata) {
         $this->iterateStructureNodes($structureMetadata, $properties[$structureMetadata->getName()], $up);
     }
     $this->session->save();
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:20,代码来源:Version201511171538.php

示例14: testOverride

 public function testOverride()
 {
     $property = new Property('url', [], 'resource_locator');
     $property->setValue('/test');
     $node = $this->sessionManager->getContentNode('sulu_io')->addNode('test');
     $node->addMixin('sulu:content');
     $this->session->save();
     $this->resourceLocator->write($node, $property, 1, 'sulu_io', 'en');
     $this->assertEquals('/test', $node->getPropertyValue('url'));
     $this->assertTrue($this->session->getRootNode()->hasNode('cmf/sulu_io/routes/en/test'));
     $property->setValue('/test-2');
     $this->resourceLocator->write($node, $property, 1, 'sulu_io', 'en');
     $this->assertEquals('/test-2', $node->getPropertyValue('url'));
     $this->assertTrue($this->session->getRootNode()->hasNode('cmf/sulu_io/routes/en/test-2'));
 }
开发者ID:Silwereth,项目名称:sulu,代码行数:15,代码来源:ResourceLocatorTest.php

示例15: reorderNode

 /**
  * {@inheritdoc}
  */
 public function reorderNode($sourcePath, $position)
 {
     $node = $this->getNode($sourcePath);
     $parent = $node->getParent();
     $nodeNames = $parent->getNodeNames();
     if ($position == 0) {
         $parent->orderBefore($node->getName(), $nodeNames[$position]);
     } elseif (isset($nodeNames[$position + 1])) {
         $parent->orderBefore($node->getName(), $nodeNames[$position + 1]);
     } else {
         $lastName = $nodeNames[count($nodeNames) - 1];
         $parent->orderBefore($node->getName(), $lastName);
         $parent->orderBefore($lastName, $node->getName());
     }
     $this->session->save();
 }
开发者ID:symfony-cmf,项目名称:resource,代码行数:19,代码来源:PhpcrRepository.php


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