本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Repository\WorkspaceRepository::update方法的典型用法代码示例。如果您正苦于以下问题:PHP WorkspaceRepository::update方法的具体用法?PHP WorkspaceRepository::update怎么用?PHP WorkspaceRepository::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Repository\WorkspaceRepository
的用法示例。
在下文中一共展示了WorkspaceRepository::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeOwnerFromUsersWorkspaces
/**
* Removes ownership of all workspaces currently owned by the given user
*
* @param User $user The user currently owning workspaces
* @return void
*/
protected function removeOwnerFromUsersWorkspaces(User $user)
{
/** @var Workspace $workspace */
foreach ($this->workspaceRepository->findByOwner($user) as $workspace) {
$workspace->setOwner(null);
$this->workspaceRepository->update($workspace);
}
}
示例2: rebaseCommand
/**
* Rebase a workspace
*
* This command sets a new base workspace for the specified workspace. Note that doing so will put the possible
* changes contained in the workspace to be rebased into a different context and thus might lead to unintended
* results when being published.
*
* @param string $workspace Name of the workspace to rebase, for example "user-john"
* @param string $baseWorkspace Name of the new base workspace
* @return void
*/
public function rebaseCommand($workspace, $baseWorkspace)
{
$workspaceName = $workspace;
$workspace = $this->workspaceRepository->findOneByName($workspaceName);
if (!$workspace instanceof Workspace) {
$this->outputLine('Workspace "%s" does not exist', array($workspaceName));
$this->quit(1);
}
$baseWorkspaceName = $baseWorkspace;
$baseWorkspace = $this->workspaceRepository->findOneByName($baseWorkspaceName);
if (!$baseWorkspace instanceof Workspace) {
$this->outputLine('The base workspace "%s" does not exist', array($baseWorkspaceName));
$this->quit(2);
}
$workspace->setBaseWorkspace($baseWorkspace);
$this->workspaceRepository->update($workspace);
$this->outputLine('Set "%s" as the new base workspace for "%s".', array($baseWorkspaceName, $workspaceName));
}
示例3: rebaseAndRedirectAction
/**
* Rebase the current users personal workspace onto the given $targetWorkspace and then
* redirects to the $targetNode in the content module.
*
* @param NodeInterface $targetNode
* @param Workspace $targetWorkspace
* @return void
*/
public function rebaseAndRedirectAction(NodeInterface $targetNode, Workspace $targetWorkspace)
{
$currentAccount = $this->securityContext->getAccount();
$personalWorkspace = $this->workspaceRepository->findOneByName('user-' . $currentAccount->getAccountIdentifier());
/** @var Workspace $personalWorkspace */
if ($this->publishingService->getUnpublishedNodesCount($personalWorkspace) > 0) {
$message = $this->translator->translateById('workspaces.cantEditBecauseWorkspaceContainsChanges', [], null, null, 'Modules', 'TYPO3.Neos');
$this->addFlashMessage($message, '', Message::SEVERITY_WARNING, [], 1437833387);
$this->redirect('show', null, null, ['workspace' => $targetWorkspace]);
}
$personalWorkspace->setBaseWorkspace($targetWorkspace);
$this->workspaceRepository->update($personalWorkspace);
$contextProperties = $targetNode->getContext()->getProperties();
$contextProperties['workspaceName'] = $personalWorkspace->getName();
$context = $this->contextFactory->create($contextProperties);
$mainRequest = $this->controllerContext->getRequest()->getMainRequest();
/** @var ActionRequest $mainRequest */
$this->uriBuilder->setRequest($mainRequest);
$this->redirect('show', 'Frontend\\Node', 'TYPO3.Neos', ['node' => $context->getNode($targetNode->getPath())]);
}
示例4: updateAction
/**
* Updates a workspace
*
* @param Workspace $workspace The updated workspace
* @return void
*/
public function updateAction(Workspace $workspace)
{
$this->workspaceRepository->update($workspace);
$this->throwStatus(200, 'Workspace updated', '');
}