本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Repository\WorkspaceRepository类的典型用法代码示例。如果您正苦于以下问题:PHP WorkspaceRepository类的具体用法?PHP WorkspaceRepository怎么用?PHP WorkspaceRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WorkspaceRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserWorkspaceReturnsTheUsersWorkspaceIfAUserIsLoggedIn
/**
* @test
*/
public function getUserWorkspaceReturnsTheUsersWorkspaceIfAUserIsLoggedIn()
{
$mockUserWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock();
$mockAccount = $this->getMockBuilder('TYPO3\\Flow\\Security\\Account')->disableOriginalConstructor()->getMock();
$mockAccount->expects($this->atLeastOnce())->method('getAccountIdentifier')->will($this->returnValue('The UserName'));
$this->mockSecurityContext->expects($this->atLeastOnce())->method('getAccount')->will($this->returnValue($mockAccount));
$this->mockWorkspaceRepository->expects($this->atLeastOnce())->method('findOneByName')->with('user-TheUserName')->will($this->returnValue($mockUserWorkspace));
$this->assertSame($mockUserWorkspace, $this->userService->getUserWorkspace());
}
示例2: getPersonalWorkspaceReturnsTheUsersWorkspaceIfAUserIsLoggedIn
/**
* @test
*/
public function getPersonalWorkspaceReturnsTheUsersWorkspaceIfAUserIsLoggedIn()
{
$mockUser = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Model\\User')->disableOriginalConstructor()->getMock();
$mockUserWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock();
$this->mockUserDomainService->expects($this->atLeastOnce())->method('getCurrentUser')->will($this->returnValue($mockUser));
$this->mockUserDomainService->expects($this->atLeastOnce())->method('getUserName')->with($mockUser)->will($this->returnValue('TheUserName'));
$this->mockWorkspaceRepository->expects($this->atLeastOnce())->method('findOneByName')->with('user-TheUserName')->will($this->returnValue($mockUserWorkspace));
$this->assertSame($mockUserWorkspace, $this->userService->getPersonalWorkspace());
}
示例3: 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');
}
示例4: 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);
}
示例5: setUpRootNodeAndRepository
protected function setUpRootNodeAndRepository()
{
$this->contextFactory = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Service\\ContextFactory');
$personalContext = $this->contextFactory->create(array('workspaceName' => $this->currentTestWorkspaceName));
$this->workspaceRepository = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Repository\\WorkspaceRepository');
if ($this->liveWorkspace === NULL) {
$this->liveWorkspace = new Workspace('live');
$this->workspaceRepository->add($this->liveWorkspace);
$this->workspaceRepository->add(new Workspace($this->currentTestWorkspaceName, $this->liveWorkspace));
$this->persistenceManager->persistAll();
}
$this->nodeDataRepository = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Repository\\NodeDataRepository');
$this->rootNode = $personalContext->getNode('/');
$this->persistenceManager->persistAll();
}
示例6: setUpRootNodeAndRepository
protected function setUpRootNodeAndRepository()
{
$this->contextFactory = $this->objectManager->get(ContextFactory::class);
$personalContext = $this->contextFactory->create(array('workspaceName' => $this->currentTestWorkspaceName));
$this->workspaceRepository = $this->objectManager->get(WorkspaceRepository::class);
if ($this->liveWorkspace === null) {
$this->liveWorkspace = new Workspace('live');
$this->workspaceRepository->add($this->liveWorkspace);
$this->workspaceRepository->add(new Workspace($this->currentTestWorkspaceName, $this->liveWorkspace));
$this->persistenceManager->persistAll();
}
$this->nodeDataRepository = $this->objectManager->get(NodeDataRepository::class);
$this->rootNode = $personalContext->getNode('/');
$this->persistenceManager->persistAll();
}
示例7: setUp
public function setUp()
{
parent::setUp();
$this->workspaceRepository = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Repository\\WorkspaceRepository');
$liveWorkspace = new Workspace("live");
$this->workspaceRepository->add($liveWorkspace);
$this->nodeTypeManager = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Service\\NodeTypeManager');
$this->contextFactory = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Service\\ContextFactoryInterface');
$this->context = $this->contextFactory->create(array('workspaceName' => 'live', 'dimensions' => array('language' => array('en_US'))));
$this->nodeDataRepository = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Repository\\NodeDataRepository');
$this->queryBuilder = $this->objectManager->get('Flowpack\\ElasticSearch\\ContentRepositoryAdaptor\\Eel\\ElasticSearchQueryBuilder');
$this->nodeIndexCommandController = $this->objectManager->get('Flowpack\\ElasticSearch\\ContentRepositoryAdaptor\\Command\\NodeIndexCommandController');
$this->queryBuilder->log();
$this->initializeIndex();
$this->createNodesForNodeSearchTest();
}
开发者ID:hphoeksma,项目名称:Flowpack.ElasticSearch.ContentRepositoryAdaptor,代码行数:16,代码来源:ElasticSearchQueryTest.php
示例8: setUp
public function setUp()
{
parent::setUp();
$this->workspaceRepository = $this->objectManager->get(WorkspaceRepository::class);
$liveWorkspace = new Workspace('live');
$this->workspaceRepository->add($liveWorkspace);
$this->nodeTypeManager = $this->objectManager->get(NodeTypeManager::class);
$this->contextFactory = $this->objectManager->get(ContextFactoryInterface::class);
$this->context = $this->contextFactory->create(['workspaceName' => 'live', 'dimensions' => ['language' => ['en_US']], 'targetDimensions' => ['language' => 'en_US']]);
$rootNode = $this->context->getRootNode();
$this->siteNode = $rootNode->createNode('welcome', $this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Page'));
$this->siteNode->setProperty('title', 'welcome');
$this->nodeDataRepository = $this->objectManager->get(NodeDataRepository::class);
$this->nodeIndexCommandController = $this->objectManager->get(NodeIndexCommandController::class);
$this->createNodesForNodeSearchTest();
}
开发者ID:kdambekalns,项目名称:Flowpack.ElasticSearch.ContentRepositoryAdaptor,代码行数:16,代码来源:ElasticSearchQueryTest.php
示例9: setUp
public function setUp()
{
parent::setUp();
$this->workspaceRepository = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Repository\\WorkspaceRepository');
$liveWorkspace = new Workspace('live');
$this->workspaceRepository->add($liveWorkspace);
$this->nodeTypeManager = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Service\\NodeTypeManager');
$this->contextFactory = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Service\\ContextFactoryInterface');
$this->context = $this->contextFactory->create(['workspaceName' => 'live', 'dimensions' => ['language' => ['en_US']], 'targetDimensions' => ['language' => 'en_US']]);
$rootNode = $this->context->getRootNode();
$this->siteNode = $rootNode->createNode('welcome', $this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Page'));
$this->siteNode->setProperty('title', 'welcome');
$this->nodeDataRepository = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Repository\\NodeDataRepository');
$this->nodeIndexCommandController = $this->objectManager->get('Flowpack\\ElasticSearch\\ContentRepositoryAdaptor\\Command\\NodeIndexCommandController');
$this->createNodesForNodeSearchTest();
}
开发者ID:robertlemke,项目名称:Flowpack.ElasticSearch.ContentRepositoryAdaptor,代码行数:16,代码来源:ElasticSearchQueryTest.php
示例10: repairCommand
/**
* Repair inconsistent nodes
*
* This command analyzes and repairs the node tree structure and individual nodes
* based on the current node type configuration.
*
* The following checks will be performed:
*
* {pluginDescriptions}
* <b>Examples:</b>
*
* ./flow node:repair
*
* ./flow node:repair --node-type TYPO3.Neos.NodeTypes:Page
*
* @param string $nodeType Node type name, if empty update all declared node types
* @param string $workspace Workspace name, default is 'live'
* @param boolean $dryRun Don't do anything, but report actions
* @param boolean $cleanup If FALSE, cleanup tasks are skipped
* @return void
*/
public function repairCommand($nodeType = null, $workspace = 'live', $dryRun = false, $cleanup = true)
{
$this->pluginConfigurations = self::detectPlugins($this->objectManager);
if ($this->workspaceRepository->countByName($workspace) === 0) {
$this->outputLine('Workspace "%s" does not exist', array($workspace));
exit(1);
}
if ($nodeType !== null) {
if ($this->nodeTypeManager->hasNodeType($nodeType)) {
$nodeType = $this->nodeTypeManager->getNodeType($nodeType);
} else {
$this->outputLine('Node type "%s" does not exist', array($nodeType));
exit(1);
}
}
if ($dryRun) {
$this->outputLine('Dry run, not committing any changes.');
}
foreach ($this->pluginConfigurations as $pluginConfiguration) {
/** @var NodeCommandControllerPluginInterface $plugin */
$plugin = $pluginConfiguration['object'];
$this->outputLine('<b>' . $plugin->getSubCommandShortDescription('repair') . '</b>');
$this->outputLine();
$plugin->invokeSubCommand('repair', $this->output, $nodeType, $workspace, $dryRun, $cleanup);
$this->outputLine();
}
$this->outputLine('Node repair finished.');
}
示例11: getPersonalWorkspace
/**
* Returns the current user's personal workspace or null if no user is logged in
*
* @return Workspace
* @api
*/
public function getPersonalWorkspace()
{
$workspaceName = $this->getPersonalWorkspaceName();
if ($workspaceName !== null) {
return $this->workspaceRepository->findOneByName($this->getPersonalWorkspaceName());
}
}
示例12: nodesCommand
/**
* Creates a big collection of node for performance benchmarking
* @param string $siteNode
* @param string $preset
*/
public function nodesCommand($siteNode, $preset)
{
if (!isset($this->presets[$preset])) {
$this->outputLine('Error: Invalid preset');
$this->quit(1);
}
$preset = $this->presets[$preset];
/** @var Site $currentSite */
$currentSite = $this->siteRepository->findOneByNodeName($siteNode);
if ($currentSite === null) {
$this->outputLine('Error: No site for exporting found');
$this->quit(1);
}
/** @var ContentContext $contentContext */
$contentContext = $this->createContext($currentSite, 'live');
$workspace = 'live';
if ($this->workspaceRepository->findByName($workspace)->count() === 0) {
$this->outputLine('Workspace "%s" does not exist', array($workspace));
$this->quit(1);
}
/** @var Node $siteNode */
$siteNode = $contentContext->getCurrentSiteNode();
if ($siteNode === null) {
$this->outputLine('Error: No site root node');
$this->quit(1);
}
$preset = new PresetDefinition($siteNode, $preset);
$generator = new NodesGenerator($preset);
$generator->generate();
}
示例13: pruneAll
/**
* Remove all nodes, workspaces, domains and sites.
*
* @return void
*/
public function pruneAll()
{
$sites = $this->siteRepository->findAll();
$this->nodeDataRepository->removeAll();
$this->workspaceRepository->removeAll();
$this->domainRepository->removeAll();
$this->siteRepository->removeAll();
foreach ($sites as $site) {
$this->emitSitePruned($site);
}
}
示例14: nodePathAvailableForNodeWillReturnFalseIfNodeWithGivenPathExistsAlready
/**
* @test
*/
public function nodePathAvailableForNodeWillReturnFalseIfNodeWithGivenPathExistsAlready()
{
$this->workspaceRepository->add(new \TYPO3\TYPO3CR\Domain\Model\Workspace('live'));
$rootNode = $this->context->getRootNode();
$fooNode = $rootNode->createNode('foo');
$fooNode->createNode('bar');
$bazNode = $rootNode->createNode('baz');
$this->persistenceManager->persistAll();
$actualResult = $this->nodeService->nodePathAvailableForNode('/foo/bar', $bazNode);
$this->assertFalse($actualResult);
}
示例15: buildCommand
/**
* Index all nodes.
*
* This command (re-)indexes all nodes contained in the content repository and sets the schema beforehand.
*
*
* @param string $workspace
* @return void
*/
public function buildCommand($workspace = NULL)
{
$this->indexedNodes = 0;
if ($workspace === NULL) {
foreach ($this->workspaceRepository->findAll() as $workspace) {
$this->indexWorkspace($workspace->getName());
}
} else {
$this->indexWorkspace($workspace);
}
$this->outputLine('Finished indexing.');
}
开发者ID:kuborgh-mspindelhirn,项目名称:Flowpack.SimpleSearch.ContentRepositoryAdaptor,代码行数:21,代码来源:NodeIndexCommandController.php