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


PHP ContextFactoryInterface::create方法代码示例

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


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

示例1: addCurrentNodeIdentifier

 /**
  * Add the current node and all parent identifiers to be used for cache entry tagging
  *
  * @Flow\Before("method(TYPO3\Flow\Mvc\Routing\RouterCachingService->extractUuids())")
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
  * @return void
  */
 public function addCurrentNodeIdentifier(JoinPointInterface $joinPoint)
 {
     $values = $joinPoint->getMethodArgument('values');
     if (!isset($values['node']) || strpos($values['node'], '@') === false) {
         return;
     }
     // Build context explicitly without authorization checks because the security context isn't available yet
     // anyway and any Entity Privilege targeted on Workspace would fail at this point:
     $this->securityContext->withoutAuthorizationChecks(function () use($joinPoint, $values) {
         $contextPathPieces = NodePaths::explodeContextPath($values['node']);
         $context = $this->contextFactory->create(['workspaceName' => $contextPathPieces['workspaceName'], 'dimensions' => $contextPathPieces['dimensions'], 'invisibleContentShown' => true]);
         $node = $context->getNode($contextPathPieces['nodePath']);
         if (!$node instanceof NodeInterface) {
             return;
         }
         $values['node-identifier'] = $node->getIdentifier();
         $node = $node->getParent();
         $values['node-parent-identifier'] = array();
         while ($node !== null) {
             $values['node-parent-identifier'][] = $node->getIdentifier();
             $node = $node->getParent();
         }
         $joinPoint->setMethodArgument('values', $values);
     });
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:32,代码来源:RouteCacheAspect.php

示例2: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->nodeDataRepository = $this->objectManager->get(NodeDataRepository::class);
     $domainRepository = $this->objectManager->get(DomainRepository::class);
     $siteRepository = $this->objectManager->get(SiteRepository::class);
     $this->contextFactory = $this->objectManager->get(ContextFactoryInterface::class);
     $contextProperties = array('workspaceName' => 'live');
     $contentContext = $this->contextFactory->create($contextProperties);
     $siteImportService = $this->objectManager->get(SiteImportService::class);
     $siteImportService->importFromFile(__DIR__ . '/../Fixtures/NodeStructure.xml', $contentContext);
     $this->persistenceManager->persistAll();
     $currentDomain = $domainRepository->findOneByActiveRequest();
     if ($currentDomain !== null) {
         $contextProperties['currentSite'] = $currentDomain->getSite();
         $contextProperties['currentDomain'] = $currentDomain;
     } else {
         $contextProperties['currentSite'] = $siteRepository->findFirst();
     }
     $contentContext = $this->contextFactory->create($contextProperties);
     $this->contentContext = $contentContext;
     $this->propertyMapper = $this->objectManager->get(PropertyMapper::class);
     $this->baseNode = $this->contentContext->getCurrentSiteNode()->getNode('home');
     $this->linkingService = $this->objectManager->get(LinkingService::class);
     /** @var $requestHandler FunctionalTestRequestHandler */
     $requestHandler = self::$bootstrap->getActiveRequestHandler();
     $this->controllerContext = new ControllerContext(new ActionRequest($requestHandler->getHttpRequest()), $requestHandler->getHttpResponse(), new Arguments(array()), new UriBuilder());
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:31,代码来源:LinkingServiceTest.php

示例3: createNodeFromTemplateUsesWorkspacesOfContext

 /**
  * @test
  */
 public function createNodeFromTemplateUsesWorkspacesOfContext()
 {
     $nodeTemplate = $this->generateBasicNodeTemplate();
     $this->context = $this->contextFactory->create(array('workspaceName' => 'user1'));
     $rootNode = $this->context->getNode('/');
     $node = $rootNode->createNodeFromTemplate($nodeTemplate, 'just-a-node');
     $workspace = $node->getWorkspace();
     $this->assertEquals('user1', $workspace->getName(), 'Node should be created in workspace of context');
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:12,代码来源:NodeTemplatesTest.php

示例4: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->nodeDataRepository = new \TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository();
     $this->contextFactory = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Service\ContextFactoryInterface::class);
     $this->context = $this->contextFactory->create(array('workspaceName' => 'live'));
     $this->nodeTypeManager = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Service\NodeTypeManager::class);
     $this->contentDimensionRepository = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Repository\ContentDimensionRepository::class);
     $this->workspaceRepository = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Repository\WorkspaceRepository::class);
     $this->nodeService = $this->objectManager->get(NodeService::class);
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:14,代码来源:NodeServiceTest.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     $this->markSkippedIfNodeTypesPackageIsNotInstalled();
     $this->contextFactory = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Service\\ContextFactoryInterface');
     $contentContext = $this->contextFactory->create(array('workspaceName' => 'live'));
     $this->siteImportService = $this->objectManager->get('TYPO3\\Neos\\Domain\\Service\\SiteImportService');
     $this->siteExportService = $this->objectManager->get('TYPO3\\Neos\\Domain\\Service\\SiteExportService');
     $this->importedSite = $this->siteImportService->importFromFile(__DIR__ . '/' . $this->fixtureFileName, $contentContext);
     $this->persistenceManager->persistAll();
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:11,代码来源:SiteImportExportServiceTest.php

示例6: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->nodeTypeManager = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Service\NodeTypeManager::class);
     $this->liveWorkspace = new Workspace('live');
     $this->workspaceRepository = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Repository\WorkspaceRepository::class);
     $this->workspaceRepository->add($this->liveWorkspace);
     $this->persistenceManager->persistAll();
     $this->contextFactory = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Service\ContextFactoryInterface::class);
     $this->context = $this->contextFactory->create(['workspaceName' => 'live']);
     $this->nodeDataRepository = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository::class);
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:15,代码来源:NodeDataRepositoryTest.php

示例7: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->nodeTypeManager = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Service\\NodeTypeManager');
     $this->liveWorkspace = new Workspace('live');
     $this->workspaceRepository = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Repository\\WorkspaceRepository');
     $this->workspaceRepository->add($this->liveWorkspace);
     $this->persistenceManager->persistAll();
     $this->contextFactory = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Service\\ContextFactoryInterface');
     $this->context = $this->contextFactory->create(array('workspaceName' => 'live'));
     $this->nodeDataRepository = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Repository\\NodeDataRepository');
 }
开发者ID:simonschaufi,项目名称:neos-development-collection,代码行数:15,代码来源:NodeDataRepositoryTest.php

示例8: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->nodeDataRepository = new NodeDataRepository();
     $this->contextFactory = $this->objectManager->get(ContextFactoryInterface::class);
     $this->nodeTypeManager = $this->objectManager->get(NodeTypeManager::class);
     $workspace = new Workspace('live');
     $this->objectManager->get(WorkspaceRepository::class)->add($workspace);
     $this->persistenceManager->persistAll();
     $context = $this->contextFactory->create(array('workspaceName' => 'live'));
     $this->rootNode = $context->getRootNode();
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:15,代码来源:NodeConstraintsTest.php

示例9: setUp

 public function setUp()
 {
     parent::setUp();
     $this->markSkippedIfNodeTypesPackageIsNotInstalled();
     $this->contextFactory = $this->objectManager->get(ContextFactoryInterface::class);
     $contentContext = $this->contextFactory->create(array('workspaceName' => 'live'));
     $siteImportService = $this->objectManager->get(SiteImportService::class);
     $siteImportService->importFromFile(__DIR__ . '/' . $this->fixtureFileName, $contentContext);
     $this->persistenceManager->persistAll();
     if ($this->nodeContextPath !== null) {
         $this->node = $this->getNodeWithContextPath($this->nodeContextPath);
     }
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:13,代码来源:AbstractNodeTest.php

示例10: getContext

 /**
  * Create a context object based on the context stored in the node path
  *
  * @param string $contextArguments
  * @return Context
  */
 protected function getContext($contextArguments)
 {
     $contextConfiguration = explode(';', $contextArguments);
     $workspaceName = array_shift($contextConfiguration);
     $dimensionConfiguration = explode('&', array_shift($contextConfiguration));
     $dimensions = array();
     foreach ($contextConfiguration as $dimension) {
         list($dimensionName, $dimensionValue) = explode('=', $dimension);
         $dimensions[$dimensionName] = explode(',', $dimensionValue);
     }
     $context = $this->contextFactory->create(array('workspaceName' => $workspaceName, 'dimensions' => $dimensions, 'invisibleContentShown' => true));
     return $context;
 }
开发者ID:reinis-zumbergs,项目名称:neos-development-collection,代码行数:19,代码来源:RouteCacheAspect.php

示例11: getList

 /**
  * @return string
  */
 public final function getList()
 {
     $context = $this->contextFactory->create(['workspaceName' => 'live']);
     $flowQuery = new FlowQuery([$context->getRootNode()]);
     $events = $flowQuery->find('[instanceof Nieuwenhuizen.BuJitsuDo:Article]')->get();
     $result['articles'] = [];
     usort($events, function (NodeInterface $a, NodeInterface $b) {
         return $this->sortNodesSelection($a, $b, 'publicationDate', false);
     });
     foreach ($events as $event) {
         $result['articles'][] = $this->buildSingleItemJson($event);
     }
     return $result;
 }
开发者ID:keen-vantage,项目名称:BuJitsuDo.Api,代码行数:17,代码来源:NewsService.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     $this->router->setRoutesConfiguration(null);
     $this->nodeDataRepository = $this->objectManager->get(NodeDataRepository::class);
     $domainRepository = $this->objectManager->get(DomainRepository::class);
     $siteRepository = $this->objectManager->get(SiteRepository::class);
     $this->contextFactory = $this->objectManager->get(ContextFactoryInterface::class);
     $contextProperties = array('workspaceName' => 'live');
     $contentContext = $this->contextFactory->create($contextProperties);
     $siteImportService = $this->objectManager->get(SiteImportService::class);
     $siteImportService->importFromFile(__DIR__ . '/../../Fixtures/NodeStructure.xml', $contentContext);
     $this->persistenceManager->persistAll();
     /** @var Domain $currentDomain */
     $currentDomain = $domainRepository->findOneByActiveRequest();
     if ($currentDomain !== null) {
         $contextProperties['currentSite'] = $currentDomain->getSite();
         $contextProperties['currentDomain'] = $currentDomain;
     } else {
         $contextProperties['currentSite'] = $siteRepository->findFirst();
     }
     $contentContext = $this->contextFactory->create($contextProperties);
     $this->contentContext = $contentContext;
     $this->propertyMapper = $this->objectManager->get(PropertyMapper::class);
     $this->viewHelper = new NodeViewHelper();
     /** @var $requestHandler FunctionalTestRequestHandler */
     $requestHandler = self::$bootstrap->getActiveRequestHandler();
     $httpRequest = $requestHandler->getHttpRequest();
     $httpRequest->setBaseUri(new Uri('http://neos.test/'));
     $controllerContext = new ControllerContext(new ActionRequest($httpRequest), $requestHandler->getHttpResponse(), new Arguments(array()), new UriBuilder());
     $this->inject($this->viewHelper, 'controllerContext', $controllerContext);
     $typoScriptObject = $this->getAccessibleMock(TemplateImplementation::class, array('dummy'), array(), '', false);
     $this->tsRuntime = new Runtime(array(), $controllerContext);
     $this->tsRuntime->pushContextArray(array('documentNode' => $this->contentContext->getCurrentSiteNode()->getNode('home'), 'alternativeDocumentNode' => $this->contentContext->getCurrentSiteNode()->getNode('home/about-us/mission')));
     $this->inject($typoScriptObject, 'tsRuntime', $this->tsRuntime);
     /** @var AbstractTemplateView|\PHPUnit_Framework_MockObject_MockObject $mockView */
     $mockView = $this->getAccessibleMock(FluidView::class, array(), array(), '', false);
     $mockView->expects($this->any())->method('getTypoScriptObject')->will($this->returnValue($typoScriptObject));
     $viewHelperVariableContainer = new ViewHelperVariableContainer();
     $viewHelperVariableContainer->setView($mockView);
     $this->inject($this->viewHelper, 'viewHelperVariableContainer', $viewHelperVariableContainer);
     $templateVariableContainer = new TemplateVariableContainer(array());
     $this->inject($this->viewHelper, 'templateVariableContainer', $templateVariableContainer);
     $this->viewHelper->setRenderChildrenClosure(function () use($templateVariableContainer) {
         $linkedNode = $templateVariableContainer->get('linkedNode');
         return $linkedNode !== null ? $linkedNode->getLabel() : '';
     });
     $this->viewHelper->initialize();
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:49,代码来源:NodeViewHelperTest.php

示例13: execute

 /**
  * Change the property on the given node.
  *
  * @param NodeData $node
  * @return NodeData
  */
 public function execute(NodeData $node)
 {
     $node = $this->nodeFactory->createFromNodeData($node, $this->contextFactory->create(array('workspaceName' => $node->getWorkspace()->getName(), 'invisibleContentShown' => true, 'inaccessibleContentShown' => true)));
     if (!$node) {
         return;
     }
     $column0 = $node->getPrimaryChildNode();
     if (!$column0) {
         return;
     }
     foreach ($column0->getChildNodes() as $childNode) {
         $node = $childNode->copyAfter($node, NodePaths::generateRandomNodeName());
     }
     return $node;
 }
开发者ID:neos,项目名称:Neos.NeosIo,代码行数:21,代码来源:ContainerTransformation.php

示例14: setDimensionsToEMptyArrayRemovesDimensions

 /**
  * @test
  */
 public function setDimensionsToEMptyArrayRemovesDimensions()
 {
     $siteImportService = $this->objectManager->get(SiteImportService::class);
     $siteImportService->importFromFile(__DIR__ . '/../Fixtures/NodeStructure.xml', $this->context);
     $this->persistenceManager->persistAll();
     $this->inject($this->contextFactory, 'contextInstances', []);
     $nodeDataRepository = $this->objectManager->get(NodeDataRepository::class);
     // The context is not important here, just a quick way to get a (live) workspace
     $context = $this->contextFactory->create();
     // The identifier comes from the Fixture.
     /** @var \TYPO3\TYPO3CR\Domain\Model\NodeData $resultingNodeData */
     $resultingNodeData = $nodeDataRepository->findOneByIdentifier('9fa376af-a1b8-83ac-bedc-9ad83c8598bc', $context->getWorkspace(true), []);
     $this->assertNotEmpty($resultingNodeData->getDimensions());
     $resultingNodeData->setDimensions([]);
     $nodeDataRepository->update($resultingNodeData);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $this->inject($this->contextFactory, 'contextInstances', []);
     // The context is not important here, just a quick way to get a (live) workspace
     $context = $this->contextFactory->create();
     // The identifier comes from the Fixture.
     /** @var \TYPO3\TYPO3CR\Domain\Model\NodeData $resultingNodeData */
     $resultingNodeData = $nodeDataRepository->findOneByIdentifier('9fa376af-a1b8-83ac-bedc-9ad83c8598bc', $context->getWorkspace(true), []);
     $this->assertEmpty($resultingNodeData->getDimensions());
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:28,代码来源:NodeDataTest.php

示例15: importSite

 /**
  * @param \TYPO3\Form\Core\Model\FinisherContext $finisherContext
  * @return void
  * @throws \TYPO3\Setup\Exception
  */
 public function importSite(\TYPO3\Form\Core\Model\FinisherContext $finisherContext)
 {
     $formValues = $finisherContext->getFormRuntime()->getFormState()->getFormValues();
     if (isset($formValues['prune']) && intval($formValues['prune']) === 1) {
         $this->nodeDataRepository->removeAll();
         $this->workspaceRepository->removeAll();
         $this->domainRepository->removeAll();
         $this->siteRepository->removeAll();
         $this->persistenceManager->persistAll();
     }
     if (!empty($formValues['packageKey'])) {
         if ($this->packageManager->isPackageAvailable($formValues['packageKey'])) {
             throw new \TYPO3\Setup\Exception(sprintf('The package key "%s" already exists.', $formValues['packageKey']), 1346759486);
         }
         $packageKey = $formValues['packageKey'];
         $siteName = $formValues['siteName'];
         $generatorService = $this->objectManager->get('TYPO3\\Neos\\Kickstarter\\Service\\GeneratorService');
         $generatorService->generateSitePackage($packageKey, $siteName);
     } elseif (!empty($formValues['site'])) {
         $packageKey = $formValues['site'];
     }
     $this->deactivateOtherSitePackages($packageKey);
     $this->packageManager->activatePackage($packageKey);
     if (!empty($packageKey)) {
         try {
             $contentContext = $this->contextFactory->create(array('workspaceName' => 'live'));
             $this->siteImportService->importFromPackage($packageKey, $contentContext);
         } catch (\Exception $exception) {
             $finisherContext->cancel();
             $this->systemLogger->logException($exception);
             throw new SetupException(sprintf('Error: During the import of the "Sites.xml" from the package "%s" an exception occurred: %s', $packageKey, $exception->getMessage()), 1351000864);
         }
     }
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:39,代码来源:SiteImportStep.php


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