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


PHP Service\ContextFactoryInterface类代码示例

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


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

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

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

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

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

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

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

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

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

示例9: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $workspaceRepository = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Repository\WorkspaceRepository::class);
     $workspaceRepository->add(new Workspace('live'));
     $this->persistenceManager->persistAll();
     $this->contextFactory = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Service\ContextFactoryInterface::class);
     $this->context = $this->contextFactory->create(array('workspaceName' => 'live'));
     $siteImportService = $this->objectManager->get(\TYPO3\Neos\Domain\Service\SiteImportService::class);
     $siteImportService->importFromFile(__DIR__ . '/Fixtures/SortableNodes.xml', $this->context);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $this->inject($this->contextFactory, 'contextInstances', array());
     // The context is not important here, just a quick way to get a (live) workspace
     //        $context = $this->contextFactory->create();
     $this->nodeDataRepository = $this->objectManager->get(\TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository::class);
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:20,代码来源:SortOperationTest.php

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

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

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

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

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

示例15: evaluate

 /**
  * {@inheritdoc}
  *
  * @param FlowQuery $flowQuery The FlowQuery object
  * @param array $arguments The arguments for this operation
  * @return void
  */
 public function evaluate(FlowQuery $flowQuery, array $arguments)
 {
     if (!isset($arguments[0]) || !is_array($arguments[0])) {
         throw new \TYPO3\Eel\FlowQuery\FlowQueryException('context() requires an array argument of context properties', 1398030427);
     }
     $output = array();
     foreach ($flowQuery->getContext() as $contextNode) {
         $contextProperties = $contextNode->getContext()->getProperties();
         $modifiedContext = $this->contextFactory->create(array_merge($contextProperties, $arguments[0]));
         $nodeInModifiedContext = $modifiedContext->getNodeByIdentifier($contextNode->getIdentifier());
         if ($nodeInModifiedContext !== null) {
             $output[$nodeInModifiedContext->getPath()] = $nodeInModifiedContext;
         }
     }
     $flowQuery->setContext(array_values($output));
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:23,代码来源:ContextOperation.php


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