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


PHP Persistence\PersistenceManagerInterface类代码示例

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


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

示例1: setUp

 /**
  * Sets up this test case
  *
  */
 public function setUp()
 {
     $this->mockObjectManager = $this->getMock(\TYPO3\Flow\Object\ObjectManagerInterface::class);
     $this->route = $this->getAccessibleMock(\TYPO3\Flow\Mvc\Routing\Route::class, array('dummy'));
     $this->route->_set('objectManager', $this->mockObjectManager);
     $this->mockPersistenceManager = $this->getMock(\TYPO3\Flow\Persistence\PersistenceManagerInterface::class);
     $this->mockPersistenceManager->expects($this->any())->method('convertObjectsToIdentityArrays')->will($this->returnCallback(function ($array) {
         return $array;
     }));
     $this->inject($this->route, 'persistenceManager', $this->mockPersistenceManager);
 }
开发者ID:fcool,项目名称:flow-development-collection,代码行数:15,代码来源:RouteTest.php

示例2: createUserAndAccount

 /**
  * In this method, actually create the user / account.
  *
  * NOTE: After this method is called, the $registrationFlow is DESTROYED, so you need to store all attributes
  * in your object as you need them.
  *
  * @param RegistrationFlow $registrationFlow
  * @return void
  */
 public function createUserAndAccount(RegistrationFlow $registrationFlow)
 {
     // Create the account
     $account = new Account();
     $account->setAccountIdentifier($registrationFlow->getEmail());
     $account->setCredentialsSource($registrationFlow->getEncryptedPassword());
     $account->setAuthenticationProviderName('Sandstorm.UserManagement:Login');
     // Assign pre-configured roles
     foreach ($this->rolesForNewUsers as $roleString) {
         $account->addRole(new Role($roleString));
     }
     // Create the user
     $user = new User();
     $user->setAccount($account);
     $user->setEmail($registrationFlow->getEmail());
     if (array_key_exists('salutation', $registrationFlow->getAttributes())) {
         $user->setGender($registrationFlow->getAttributes()['salutation']);
     }
     if (array_key_exists('firstName', $registrationFlow->getAttributes())) {
         $user->setFirstName($registrationFlow->getAttributes()['firstName']);
     }
     if (array_key_exists('lastName', $registrationFlow->getAttributes())) {
         $user->setLastName($registrationFlow->getAttributes()['lastName']);
     }
     // Persist user
     $this->userRepository->add($user);
     $this->persistenceManager->whitelistObject($user);
     $this->persistenceManager->whitelistObject($account);
 }
开发者ID:sandstorm,项目名称:usermanagement,代码行数:38,代码来源:FlowUserCreationService.php

示例3: transformByAnnotation

 /**
  * @param mixed $source
  * @param \Flowpack\ElasticSearch\Annotations\Transform $annotation
  * @return string
  */
 public function transformByAnnotation($source, \Flowpack\ElasticSearch\Annotations\Transform $annotation)
 {
     if ($source != null) {
         return $this->persistenceManager->getIdentifierByObject($source);
     }
     return '';
 }
开发者ID:johannessteu,项目名称:Flowpack.ElasticSearch,代码行数:12,代码来源:ObjectIdentifierTransformer.php

示例4: findByAnimal

 /**
  * @param \DLigo\Animaltool\Domain\Model\Animal $animal
  */
 public function findByAnimal($animal)
 {
     $id = $this->persistenceManager->getIdentifierByObject($animal);
     $query = $this->createQuery();
     $query->matching($query->equals('animalId', $id))->setOrderings(array('time' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_DESCENDING));
     return $query->execute();
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:10,代码来源:HistoryChangeRepository.php

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

示例6: execute

 /**
  * Change the property on the given node.
  *
  * @param NodeData $node
  * @return void
  */
 public function execute(NodeData $node)
 {
     foreach ($node->getNodeType()->getProperties() as $propertyName => $propertyConfiguration) {
         if (isset($propertyConfiguration['type']) && in_array(trim($propertyConfiguration['type']), $this->getHandledObjectTypes())) {
             if (!isset($nodeProperties)) {
                 $nodeRecordQuery = $this->entityManager->getConnection()->prepare('SELECT properties FROM typo3_typo3cr_domain_model_nodedata WHERE persistence_object_identifier=?');
                 $nodeRecordQuery->execute([$this->persistenceManager->getIdentifierByObject($node)]);
                 $nodeRecord = $nodeRecordQuery->fetch(\PDO::FETCH_ASSOC);
                 $nodeProperties = unserialize($nodeRecord['properties']);
             }
             if (!isset($nodeProperties[$propertyName]) || !is_object($nodeProperties[$propertyName])) {
                 continue;
             }
             /** @var Asset $assetObject */
             $assetObject = $nodeProperties[$propertyName];
             $nodeProperties[$propertyName] = null;
             $stream = $assetObject->getResource()->getStream();
             if ($stream === false) {
                 continue;
             }
             fclose($stream);
             $objectType = TypeHandling::getTypeForValue($assetObject);
             $objectIdentifier = ObjectAccess::getProperty($assetObject, 'Persistence_Object_Identifier', true);
             $nodeProperties[$propertyName] = array('__flow_object_type' => $objectType, '__identifier' => $objectIdentifier);
         }
     }
     if (isset($nodeProperties)) {
         $nodeUpdateQuery = $this->entityManager->getConnection()->prepare('UPDATE typo3_typo3cr_domain_model_nodedata SET properties=? WHERE persistence_object_identifier=?');
         $nodeUpdateQuery->execute([serialize($nodeProperties), $this->persistenceManager->getIdentifierByObject($node)]);
     }
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:37,代码来源:AssetTransformation.php

示例7: renderWithoutValueInvokesRenderChildren

 /**
  * @test
  */
 public function renderWithoutValueInvokesRenderChildren()
 {
     $object = new \stdClass();
     $this->viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue($object));
     $this->mockPersistenceManager->expects($this->once())->method('getIdentifierByObject')->with($object)->will($this->returnValue('b59292c5-1a28-4b36-8615-10d3c5b3a4d8'));
     $this->assertEquals('b59292c5-1a28-4b36-8615-10d3c5b3a4d8', $this->viewHelper->render());
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:10,代码来源:IdentifierViewHelperTest.php

示例8: badgeAssertionToArray

 /**
  * @param BadgeAssertion $badgeAssertion
  * @return array
  */
 public function badgeAssertionToArray(BadgeAssertion $badgeAssertion)
 {
     $badgeClassUri = $this->controllerContext->getUriBuilder()->reset()->setCreateAbsoluteUri(TRUE)->setFormat('json')->uriFor('show', array('badgeClass' => $badgeAssertion->getBadgeClass()), 'BadgeClass');
     $badgeAssertionUri = $this->controllerContext->getUriBuilder()->reset()->setCreateAbsoluteUri(TRUE)->setFormat('json')->uriFor('show', array('badgeAssertion' => $badgeAssertion), 'BadgeAssertion');
     $badgeAssertionIdentifier = $this->persistenceManager->getIdentifierByObject($badgeAssertion);
     return array('uid' => $badgeAssertionIdentifier, 'recipient' => $badgeAssertion->getIdentityObject(), 'badge' => $badgeClassUri, 'verify' => array('type' => 'hosted', 'url' => $badgeAssertionUri), 'issuedOn' => $badgeAssertion->getIssuedOn()->format('c'));
 }
开发者ID:christophlehmann,项目名称:Networkteam.OpenBadges,代码行数:11,代码来源:ShowJson.php

示例9: generateUuid

 /**
  * After returning advice, making sure we have an UUID for each and every entity.
  *
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
  * @return void
  * @Flow\Before("TYPO3\Flow\Persistence\Aspect\PersistenceMagicAspect->isEntity && method(.*->(__construct|__clone)()) && filter(TYPO3\Flow\Persistence\Doctrine\Mapping\Driver\FlowAnnotationDriver)")
  */
 public function generateUuid(JoinPointInterface $joinPoint)
 {
     /** @var $proxy \TYPO3\Flow\Persistence\Aspect\PersistenceMagicInterface */
     $proxy = $joinPoint->getProxy();
     ObjectAccess::setProperty($proxy, 'Persistence_Object_Identifier', Algorithms::generateUUID(), TRUE);
     $this->persistenceManager->registerNewObject($proxy);
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:14,代码来源:PersistenceMagicAspect.php

示例10: getOptions

 /**
  */
 public function getOptions()
 {
     $classSchema = $this->reflectionService->getClassSchema($this->getRelationClass());
     if ($classSchema->getRepositoryClassName() !== NULL) {
         $repository = $this->objectManager->get($classSchema->getRepositoryClassName());
         $query = call_user_func(array($repository, $this->settings['QueryMethod']));
     } else {
         $query = $this->persistenceManager->createQueryForType($this->getRelationClass());
     }
     $options = $query->execute()->toArray();
     if ($this->settings['LabelPath'] !== NULL) {
         $options = array();
         foreach ($query->execute() as $option) {
             $identifier = $this->persistenceManager->getIdentifierByObject($option);
             $label = ObjectAccess::getPropertyPath($option, $this->settings['LabelPath']);
             $options[$identifier] = $label;
         }
     }
     if ($this->settings['EmptyOption'] !== NULL) {
         $newOptions = array('' => $this->settings['EmptyOption']);
         foreach ($options as $key => $value) {
             $newOptions[$key] = $value;
         }
         $options = $newOptions;
     }
     return $options;
 }
开发者ID:mia3,项目名称:expose,代码行数:29,代码来源:RelationOptionsProvider.php

示例11: getAssignedPartyOfAccount

 /**
  * Gets the Party having an Account assigned
  *
  * @param Account $account
  * @return AbstractParty
  */
 public function getAssignedPartyOfAccount(Account $account)
 {
     $accountIdentifier = $this->persistenceManager->getIdentifierByObject($account);
     if (isset($this->accountsInPartyRuntimeCache[$accountIdentifier])) {
         return $this->accountsInPartyRuntimeCache[$accountIdentifier];
     }
     return $this->partyRepository->findOneHavingAccount($account);
 }
开发者ID:Akii,项目名称:party,代码行数:14,代码来源:PartyService.php

示例12: identifyCacheTagForObject

 /**
  * Returns cache cache tag parts for the given object if known, otherwise NULL.
  *
  * @param $object
  * @return mixed
  */
 public function identifyCacheTagForObject($object)
 {
     $className = get_class($object);
     if (property_exists($object, 'Persistence_Object_Identifier') || $this->reflectionService->isClassAnnotatedWith($className, Flow\Entity::class) || $this->reflectionService->isClassAnnotatedWith($className, Flow\ValueObject::class) || $this->reflectionService->isClassAnnotatedWith($className, Doctrine\Entity::class)) {
         $identifier = $this->persistenceManager->getIdentifierByObject($object);
         return $className . '_' . $identifier;
     }
 }
开发者ID:netlogix,项目名称:Netlogix.Cachetags,代码行数:14,代码来源:DomainObjectIdentificationHelper.php

示例13: getData

 /**
  * @param NodeInterface $node The node that is currently edited (optional)
  * @param array $arguments Additional arguments (key / value)
  * @return array
  */
 public function getData(NodeInterface $node, array $arguments)
 {
     $options = [];
     foreach ($this->userService->getUsers() as $user) {
         $options[$this->persistenceManager->getIdentifierByObject($user)] = ['label' => $user->getLabel()];
     }
     return $options;
 }
开发者ID:neos,项目名称:Neos.NeosIo,代码行数:13,代码来源:EditorsDataSource.php

示例14: getData

 /**
  * Get data
  *
  * @param NodeInterface $node unused
  * @param array $arguments unused
  * @return array title of all asset collections
  */
 public function getData(NodeInterface $node = NULL, array $arguments)
 {
     $assetCollections = [];
     /** @var AssetCollection $assetCollection */
     foreach ($this->assetCollectionRepository->findAll() as $assetCollection) {
         $assetCollections[] = ['value' => $this->persistenceManager->getIdentifierByObject($assetCollection), 'label' => $assetCollection->getTitle()];
     }
     return $assetCollections;
 }
开发者ID:bwaidelich,项目名称:Wwwision.AssetConstraints,代码行数:16,代码来源:AssetCollectionDataSource.php

示例15: getNodePropertyWithBadgeClass

 /**
  * @Flow\Around("method(TYPO3\Neos\Service\ContentElementWrappingService->getNodeProperty())")
  * @param JoinPointInterface $joinPoint
  */
 public function getNodePropertyWithBadgeClass(JoinPointInterface $joinPoint)
 {
     $result = $joinPoint->getAdviceChain()->proceed($joinPoint);
     if ($result instanceof BadgeClass) {
         return json_encode($this->persistenceManager->getIdentifierByObject($result));
     } else {
         return $result;
     }
 }
开发者ID:christophlehmann,项目名称:Networkteam.OpenBadges,代码行数:13,代码来源:BadgeClassContentElementWrappingAspect.php


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