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


PHP PersistenceManagerInterface::persistAll方法代码示例

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


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

示例1: executeInternal

 /**
  * Executes this finisher
  * @see AbstractFinisher::execute()
  *
  * @return void
  * @throws \TYPO3\Flow\Mvc\Exception\StopActionException();
  */
 protected function executeInternal()
 {
     /** @var \TYPO3\Form\Core\Runtime\FormRuntime $formRuntime */
     $formRuntime = $this->finisherContext->getFormRuntime();
     $formValueArray = $formRuntime->getFormState()->getFormValues();
     /** @var \GIB\GradingTool\Domain\Model\Project $project */
     $project = $this->projectRepository->findByIdentifier($formRuntime->getRequest()->getParentRequest()->getArgument('project'));
     // store changes to project
     $project->setProjectData($formValueArray);
     $this->projectRepository->update($project);
     // add a flash message
     $message = new \TYPO3\Flow\Error\Message('The project data for "%s" was successfully edited.', \TYPO3\Flow\Error\Message::SEVERITY_OK, array($project->getProjectTitle()));
     $this->flashMessageContainer->addMessage($message);
     $this->persistenceManager->persistAll();
     // redirect to dashboard
     $formRuntime = $this->finisherContext->getFormRuntime();
     $request = $formRuntime->getRequest()->getMainRequest();
     $uriBuilder = new \TYPO3\Flow\Mvc\Routing\UriBuilder();
     $uriBuilder->setRequest($request);
     $uriBuilder->reset();
     $uri = $uriBuilder->uriFor('index', NULL, 'Admin');
     $response = $formRuntime->getResponse();
     $mainResponse = $response;
     while ($response = $response->getParentResponse()) {
         $mainResponse = $response;
     }
     $mainResponse->setStatus(303);
     $mainResponse->setHeader('Location', (string) $uri);
     throw new \TYPO3\Flow\Mvc\Exception\StopActionException();
 }
开发者ID:putheakhem,项目名称:GIB.GradingTool,代码行数:37,代码来源:ProjectDataFinisher.php

示例2: deleteById

 /**
  * @param string $identifier
  */
 public function deleteById($identifier)
 {
     $object = $this->findById($identifier);
     // todo: check if we want to throw an exception here
     if ($object !== NULL) {
         $this->persistenceManager->remove($object);
         $this->persistenceManager->persistAll();
     }
 }
开发者ID:flow2lab,项目名称:eventsourcing,代码行数:12,代码来源:AbstractModelProjector.php

示例3: initializeObject

 /**
  * Fetches the identifier from the set content object. If that
  * is not using automatically introduced UUIDs by Flow it tries
  * to call persistAll() and fetch the identifier again. If it still
  * fails, an exception is thrown.
  *
  * @return void
  * @throws \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException
  */
 protected function initializeObject()
 {
     if ($this->contentObject !== null) {
         $this->targetType = get_class($this->contentObject);
         $this->targetId = $this->persistenceManager->getIdentifierByObject($this->contentObject);
         if ($this->targetId === null) {
             $this->persistenceManager->persistAll();
             $this->targetId = $this->persistenceManager->getIdentifierByObject($this->contentObject);
             if ($this->targetId === null) {
                 throw new \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException('You cannot add an object without an identifier to a ContentObjectProxy. Probably you didn\'t add a valid entity?', 1303859434);
             }
         }
     }
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:23,代码来源:ContentObjectProxy.php

示例4: append

 /**
  * Appends the given message along with the additional information into the log.
  *
  * @param string $message The message to log
  * @param integer $severity One of the LOG_* constants
  * @param mixed $additionalData A variable containing more information about the event to be logged
  * @param string $packageKey Key of the package triggering the log (determined automatically if not specified)
  * @param string $className Name of the class triggering the log (determined automatically if not specified)
  * @param string $methodName Name of the method triggering the log (determined automatically if not specified)
  * @return void
  * @api
  */
 public function append($message, $severity = LOG_INFO, $additionalData = NULL, $packageKey = NULL, $className = NULL, $methodName = NULL)
 {
     if ($this->number < self::MAX_LOGS) {
         $log = new Log();
         $log->setDeployment($this->deployment)->setDate(new \DateTime())->setNumber(++$this->number)->setMessage($message)->setSeverity($severity);
         $this->logRepository->add($log);
         $this->persistenceManager->persistAll();
     } elseif ($this->number === self::MAX_LOGS) {
         $log = new Log();
         $log->setDeployment($this->deployment)->setDate(new \DateTime())->setNumber(++$this->number)->setMessage('logging killed with #logs > ' . self::MAX_LOGS)->setSeverity(LOG_EMERG);
         $this->logRepository->add($log);
         $this->persistenceManager->persistAll();
     }
 }
开发者ID:lightwerk,项目名称:surfrunner,代码行数:26,代码来源:DatabaseBackend.php

示例5: pruneSite

 /**
  * Remove given site all nodes for that site and all domains associated.
  *
  * @param Site $site
  * @return void
  */
 public function pruneSite(Site $site)
 {
     $siteNodePath = NodePaths::addNodePathSegment(static::SITES_ROOT_PATH, $site->getNodeName());
     $this->nodeDataRepository->removeAllInPath($siteNodePath);
     $siteNodes = $this->nodeDataRepository->findByPath($siteNodePath);
     foreach ($siteNodes as $siteNode) {
         $this->nodeDataRepository->remove($siteNode);
     }
     $domainsForSite = $this->domainRepository->findBySite($site);
     foreach ($domainsForSite as $domain) {
         $this->domainRepository->remove($domain);
     }
     $this->persistenceManager->persistAll();
     $this->siteRepository->remove($site);
     $this->emitSitePruned($site);
 }
开发者ID:sbruggmann,项目名称:neos-development-collection,代码行数:22,代码来源:SiteService.php

示例6: generateUriPathSegments

 /**
  * Generate missing URI path segments
  *
  * This generates URI path segment properties for all document nodes which don't have
  * a path segment set yet.
  *
  * @param string $workspaceName
  * @param boolean $dryRun
  * @return void
  */
 public function generateUriPathSegments($workspaceName, $dryRun)
 {
     $baseContext = $this->createContext($workspaceName, []);
     $baseContextSitesNode = $baseContext->getNode(SiteService::SITES_ROOT_PATH);
     if (!$baseContextSitesNode) {
         $this->output->outputLine('<error>Could not find "' . SiteService::SITES_ROOT_PATH . '" root node</error>');
         return;
     }
     $baseContextSiteNodes = $baseContextSitesNode->getChildNodes();
     if ($baseContextSiteNodes === []) {
         $this->output->outputLine('<error>Could not find any site nodes in "' . SiteService::SITES_ROOT_PATH . '" root node</error>');
         return;
     }
     foreach ($this->dimensionCombinator->getAllAllowedCombinations() as $dimensionCombination) {
         $flowQuery = new FlowQuery($baseContextSiteNodes);
         $siteNodes = $flowQuery->context(['dimensions' => $dimensionCombination, 'targetDimensions' => []])->get();
         if (count($siteNodes) > 0) {
             $this->output->outputLine('Checking for nodes with missing URI path segment in dimension "%s"', array(trim(NodePaths::generateContextPath('', '', $dimensionCombination), '@;')));
             foreach ($siteNodes as $siteNode) {
                 $this->generateUriPathSegmentsForNode($siteNode, $dryRun);
             }
         }
     }
     $this->persistenceManager->persistAll();
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:35,代码来源:NodeCommandControllerPlugin.php

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

示例8: createUserPhlu

 /**
  * Creates a user based on the given information
  *
  * The created user and account are automatically added to their respective repositories and thus be persisted.
  *
  * @param string $username The username of the user to be created.
  * @param string $password Password of the user to be created
  * @param string $firstName First name of the user to be created
  * @param string $lastName Last name of the user to be created
  * @param string $department department of the user to be created
  * @param string $photo photo of the user to be created
  * @param array $roleIdentifiers A list of role identifiers to assign
  * @param string $authenticationProviderName Name of the authentication provider to use. Example: "Typo3BackendProvider"
  * @return User The created user instance
  * @api
  */
 public function createUserPhlu($username, $password, $firstName, $lastName, $department, $photo, array $roleIdentifiers = null, $authenticationProviderName = null)
 {
     $collection = $this->assetCollectionRepository->findByCollectionName('phluCollection2')->getFirst();
     if (!$collection) {
         $collection = new \TYPO3\Media\Domain\Model\AssetCollection('phluCollection2');
         $this->assetCollectionRepository->add($collection);
         $this->persistenceManager->persistAll();
     }
     $user = new User();
     $user->setDepartment($department);
     $name = new PersonName('', $firstName, '', $lastName, '', $username);
     $user->setName($name);
     $resource = $this->resourceManager->importResource($photo);
     $image = new Image($resource);
     $image->setTitle($name->getFullName());
     $tag = $this->tagRepository->findBySearchTerm('Hauswart')->getFirst();
     if (!$tag) {
         $tag = new Tag();
         $tag->setLabel('Hauswart');
         $this->tagRepository->add($tag);
         $collection->addTag($tag);
     }
     $image->addTag($tag);
     $user->setPhoto($image);
     $this->assetRepository->add($image);
     $collection->addAsset($image);
     $this->assetCollectionRepository->update($collection);
     return $this->addUserPhlu($username, $password, $user, $roleIdentifiers, $authenticationProviderName);
 }
开发者ID:phluzern,项目名称:sites.phlu.ch,代码行数:45,代码来源:UserService.php

示例9: executeInternal

 /**
  * Executes this finisher
  * @see AbstractFinisher::execute()
  *
  * @return void
  * @throws \TYPO3\Flow\Mvc\Exception\StopActionException();
  */
 protected function executeInternal()
 {
     /** @var \TYPO3\Form\Core\Runtime\FormRuntime $formRuntime */
     $formRuntime = $this->finisherContext->getFormRuntime();
     $formValueArray = $formRuntime->getFormState()->getFormValues();
     if ($formRuntime->getRequest()->getParentRequest()->getControllerActionName() == 'edit') {
         // we need to update the template
         /** @var \GIB\GradingTool\Domain\Model\Template $template */
         $template = $this->templateRepository->findByIdentifier($formRuntime->getRequest()->getParentRequest()->getArgument('template')['__identity']);
         $template->setTemplateIdentifier($formValueArray['templateIdentifier']);
         $template->setContent(serialize($formValueArray));
         //$project->setLastUpdated(new \TYPO3\Flow\Utility\Now);
         $this->templateRepository->update($template);
         // add a flash message
         $message = new \TYPO3\Flow\Error\Message('The template "%s" was successfully edited.', \TYPO3\Flow\Error\Message::SEVERITY_OK, array($template->getTemplateIdentifier()));
         $this->flashMessageContainer->addMessage($message);
     } else {
         // we need to add a new template
         /** @var \GIB\GradingTool\Domain\Model\Template $template */
         $template = new \GIB\GradingTool\Domain\Model\Template();
         $template->setTemplateIdentifier($formValueArray['templateIdentifier']);
         // serialize all form content and store it
         $template->setContent(serialize($formValueArray));
         //$project->setCreated(new \TYPO3\Flow\Utility\Now);
         $this->templateRepository->add($template);
         // add a flash message
         $message = new \TYPO3\Flow\Error\Message('The template "%s" was successfully created.', \TYPO3\Flow\Error\Message::SEVERITY_OK, array($formValueArray['templateIdentifier']));
         $this->flashMessageContainer->addMessage($message);
     }
     $this->persistenceManager->persistAll();
     // redirect to dashboard
     $formRuntime = $this->finisherContext->getFormRuntime();
     $request = $formRuntime->getRequest()->getMainRequest();
     $uriBuilder = new \TYPO3\Flow\Mvc\Routing\UriBuilder();
     $uriBuilder->setRequest($request);
     $uriBuilder->reset();
     $uri = $uriBuilder->uriFor('list', NULL, 'Template');
     $response = $formRuntime->getResponse();
     $mainResponse = $response;
     while ($response = $response->getParentResponse()) {
         $mainResponse = $response;
     }
     $mainResponse->setStatus(303);
     $mainResponse->setHeader('Location', (string) $uri);
     throw new \TYPO3\Flow\Mvc\Exception\StopActionException();
 }
开发者ID:putheakhem,项目名称:GIB.GradingTool,代码行数:53,代码来源:TemplateDatabaseFinisher.php

示例10: generateTokenAccount

 /**
  * @return \TYPO3\Flow\Security\Account
  * @throws Exception
  * @throws \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException
  */
 protected function generateTokenAccount()
 {
     $account = $this->securityContext->getAccount();
     $tokenAccount = $this->accountFactory->createAccountWithPassword($account->getAccountIdentifier(), Algorithms::generateRandomString(25), array_keys($account->getRoles()), $this->apiToken->getAuthenticationProviderName());
     $this->accountRepository->add($tokenAccount);
     $this->persistenceManager->persistAll();
     return $tokenAccount;
 }
开发者ID:rfyio,项目名称:JWT,代码行数:13,代码来源:TokenFactory.php

示例11: removeRoleByEmail

 /**
  * @param string $email
  * @param \Ag\Login\Domain\Model\Role $role
  * @return \Ag\Login\Domain\Model\AccountDescriptor
  */
 public function removeRoleByEmail($email, $role)
 {
     $account = $this->getAccountByEmailThrowExceptionIfNotExistsing($email);
     $account->removeRole($role);
     $this->accountRepository->update($account);
     $this->persistenceManager->persistAll();
     return $account->getDescriptor();
 }
开发者ID:putheakhem,项目名称:login,代码行数:13,代码来源:AccountService.php

示例12: finalizePersistingNewUser

 /**
  * Persists new Account.
  *
  * @param Account $account
  *
  * @return void
  */
 public function finalizePersistingNewUser(Account $account)
 {
     $party = $account->getParty();
     if ($party instanceof AbstractParty) {
         $this->partyRepository->add($party);
     }
     $this->accountRepository->add($account);
     $this->persistenceManager->persistAll();
 }
开发者ID:rafaelka,项目名称:jasigphpcas,代码行数:16,代码来源:DefaultMapper.php

示例13: addRedirectByHost

 /**
  * Adds a redirect to the repository and updates related redirects accordingly.
  *
  * @param string $sourceUriPath the relative URI path that should trigger a redirect
  * @param string $targetUriPath the relative URI path the redirect should point to
  * @param int $statusCode the status code of the redirect header
  * @param string $host the host for the current redirect
  * @return Redirect the freshly generated redirect DTO instance
  * @api
  */
 protected function addRedirectByHost($sourceUriPath, $targetUriPath, $statusCode, $host = null)
 {
     $redirect = new Redirect($sourceUriPath, $targetUriPath, $statusCode, $host);
     $this->updateDependingRedirects($redirect);
     $this->persistenceManager->persistAll();
     $this->redirectRepository->add($redirect);
     $this->routerCachingService->flushCachesForUriPath($sourceUriPath);
     return RedirectDto::create($redirect);
 }
开发者ID:neos,项目名称:redirecthandler-databasestorage,代码行数:19,代码来源:RedirectStorage.php

示例14: executeInternal

 /**
  * Executes this finisher
  * @see AbstractFinisher::execute()
  *
  * @return void
  * @throws \TYPO3\Flow\Mvc\Exception\StopActionException();
  */
 protected function executeInternal()
 {
     /** @var \TYPO3\Form\Core\Runtime\FormRuntime $formRuntime */
     $formRuntime = $this->finisherContext->getFormRuntime();
     // The corresponding project
     $projectIdentifier = $formRuntime->getRequest()->getParentRequest()->getArgument('project');
     /** @var \GIB\GradingTool\Domain\Model\Project $project */
     $project = $this->projectRepository->findByIdentifier($projectIdentifier);
     $sendGradingToProjectManager = FALSE;
     if (is_null($project->getSubmissionLastUpdated())) {
         $sendGradingToProjectManager = TRUE;
     }
     // update the project with the data from the form
     $formValueArray = $formRuntime->getFormState()->getFormValues();
     $project->setSubmissionContent(serialize($formValueArray));
     $project->setSubmissionLastUpdated(new \TYPO3\Flow\Utility\Now());
     $this->projectRepository->update($project);
     $this->persistenceManager->persistAll();
     // add a flash message
     $message = new \TYPO3\Flow\Error\Message('Thank you for submitting the data for your project "%s".', \TYPO3\Flow\Error\Message::SEVERITY_OK, array($project->getProjectTitle()));
     $this->flashMessageContainer->addMessage($message);
     // send notification mail
     $templateIdentifierOverlay = $this->templateService->getTemplateIdentifierOverlay('newSubmissionNotification', $project);
     $this->notificationMailService->sendNotificationMail($templateIdentifierOverlay, $project, $project->getProjectManager());
     if ($sendGradingToProjectManager) {
         // The grading was completed for the first time, so we send the grading to the project manager
         $this->submissionService->sendGradingToProjectManager($project);
     }
     // redirect to dashboard
     $formRuntime = $this->finisherContext->getFormRuntime();
     $request = $formRuntime->getRequest()->getMainRequest();
     $uriBuilder = new \TYPO3\Flow\Mvc\Routing\UriBuilder();
     $uriBuilder->setRequest($request);
     $uriBuilder->reset();
     $uri = $uriBuilder->uriFor('index', NULL, 'Standard');
     $response = $formRuntime->getResponse();
     $mainResponse = $response;
     while ($response = $response->getParentResponse()) {
         $mainResponse = $response;
     }
     $mainResponse->setStatus(303);
     $mainResponse->setHeader('Location', (string) $uri);
     throw new \TYPO3\Flow\Mvc\Exception\StopActionException();
 }
开发者ID:putheakhem,项目名称:GIB.GradingTool,代码行数:51,代码来源:SubmissionFinisher.php

示例15: findOrCreateMetaDataRootNode

 /**
  * @param Context $context
  * @return NodeInterface
  * @throws NodeTypeNotFoundException
  * @throws NodeConfigurationException
  */
 public function findOrCreateMetaDataRootNode(Context $context)
 {
     if ($this->metaDataRootNode instanceof NodeInterface) {
         return $this->metaDataRootNode;
     }
     $metaDataRootNodeData = $this->metaDataRepository->findOneByPath('/' . MetaDataRepository::METADATA_ROOT_NODE_NAME, $context->getWorkspace());
     if ($metaDataRootNodeData !== null) {
         $metaDataRootNode = $this->nodeFactory->createFromNodeData($metaDataRootNodeData, $context);
         return $metaDataRootNode;
     }
     $nodeTemplate = new NodeTemplate();
     $nodeTemplate->setNodeType($this->nodeTypeManager->getNodeType('unstructured'));
     $nodeTemplate->setName(MetaDataRepository::METADATA_ROOT_NODE_NAME);
     $context = $this->contextFactory->create(['workspaceName' => 'live']);
     $rootNode = $context->getRootNode();
     $this->metaDataRootNode = $rootNode->createNodeFromTemplate($nodeTemplate);
     $this->persistenceManager->persistAll();
     return $this->metaDataRootNode;
 }
开发者ID:neos,项目名称:metadata-contentrepositoryadapter,代码行数:25,代码来源:NodeService.php


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