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


PHP ObjectManager::refresh方法代码示例

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


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

示例1: assertPersistedPropertyValue

 public function assertPersistedPropertyValue($entity, $propertyName, $expectedPropertyValue, $forceDirectAccess = true)
 {
     $this->entityManager->refresh($entity);
     $persistedPropertyValue = ObjectAccess::getProperty($entity, $propertyName, $forceDirectAccess);
     $this->test->assertSame($expectedPropertyValue, $persistedPropertyValue, 'The property ' . $propertyName . ' did not have the expected persistent value');
     return $this;
 }
开发者ID:econic,项目名称:testing,代码行数:7,代码来源:PersistenceTester.php

示例2: process

 /**
  * Process form
  *
  * @param  EmailTemplate $entity
  *
  * @return bool True on successful processing, false otherwise
  */
 public function process(EmailTemplate $entity)
 {
     // always use default locale during template edit in order to allow update of default locale
     $entity->setLocale($this->defaultLocale);
     if ($entity->getId()) {
         // refresh translations
         $this->manager->refresh($entity);
     }
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
         // deny to modify system templates
         if ($entity->getIsSystem() && !$entity->getIsEditable()) {
             $this->form->addError(new FormError($this->translator->trans('oro.email.handler.attempt_save_system_template')));
             return false;
         }
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             // mark an email template creating by an user as editable
             if (!$entity->getId()) {
                 $entity->setIsEditable(true);
             }
             $this->manager->persist($entity);
             $this->manager->flush();
             return true;
         }
     }
     return false;
 }
开发者ID:Maksold,项目名称:platform,代码行数:35,代码来源:EmailTemplateHandler.php

示例3: saveAddress

 /**
  * Saves an address making a copy in case it was already persisted. Then
  * returns the saved address.
  *
  * @param AddressInterface $address The address to save
  *
  * @return AddressInterface saved address.
  */
 public function saveAddress(AddressInterface $address)
 {
     if ($address->getId()) {
         $addressToSave = clone $address;
         $addressToSave->setId(null);
         $this->addressObjectManager->refresh($address);
         $this->addressObjectManager->persist($addressToSave);
         $this->addressObjectManager->flush($addressToSave);
         $this->addressEventDispatcher->dispatchAddressOnCloneEvent($address, $addressToSave);
         return $addressToSave;
     }
     $this->addressObjectManager->flush($address);
     return $address;
 }
开发者ID:axelvnk,项目名称:elcodi,代码行数:22,代码来源:AddressManager.php

示例4: refreshEntity

 public function refreshEntity($entity)
 {
     if (!in_array($entity, $this->managedEntities)) {
         throw new \Exception('The entity to be refreshed is not handled by the entity factory', 1416484011);
     }
     $this->entityManager->refresh($entity);
 }
开发者ID:econic,项目名称:testing,代码行数:7,代码来源:EntityFactory.php

示例5: load

 /**
  *
  * @access public
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $userAdmin = new User();
     $userAdmin->setUsername('admin');
     $userAdmin->setUsernameCanonical('admin');
     $userAdmin->setPlainPassword('root');
     $userAdmin->setEmail('admin@codeconsortium.com');
     $userAdmin->setEmailCanonical('admin@codeconsortium.com');
     $userAdmin->setEnabled(true);
     $userAdmin->setRoles(array('ROLE_USER', 'ROLE_MODERATOR', 'ROLE_ADMIN'));
     $userAdmin->setSuperAdmin(true);
     $userAdmin->setRegisteredDate(new \DateTime('now'));
     $userTest = new User();
     $userTest->setUsername('test');
     $userTest->setUsernameCanonical('test');
     $userTest->setPlainPassword('root');
     $userTest->setEmail('test@codeconsortium.com');
     $userTest->setEmailCanonical('test@codeconsortium.com');
     $userTest->setEnabled(true);
     $userTest->setRoles(array('ROLE_USER'));
     $userTest->setRegisteredDate(new \DateTime('now'));
     $userManager = $this->container->get('fos_user.user_manager');
     $userManager->updateUser($userAdmin);
     $userManager->updateUser($userTest);
     $manager->refresh($userAdmin, $userTest);
     $this->addReference('user-admin', $userAdmin);
     $this->addReference('user-test', $userTest);
 }
开发者ID:moave,项目名称:CCDNUserUserBundle,代码行数:33,代码来源:LoadUserData.php

示例6: getAction

 /**
  * Get completeness for a product
  *
  * @param int|string $id
  *
  * @return JSONResponse
  */
 public function getAction($id)
 {
     $product = $this->productRepository->getFullProduct($id);
     if (null === $product->getFamily()) {
         return new JsonResponse();
     }
     $this->completenessManager->generateMissingForProduct($product);
     // Product have to be refreshed to have the completeness values generated by generateMissingForProduct()
     // (on ORM, completeness is not calculated the same way and product doesn't need to be refreshed)
     if (AkeneoStorageUtilsExtension::DOCTRINE_MONGODB_ODM === $this->storageDriver) {
         $this->productManager->refresh($product);
     }
     $channels = $this->channelRepository->getFullChannels();
     $locales = $this->userContext->getUserLocales();
     $filteredLocales = $this->collectionFilter->filterCollection($locales, 'pim.internal_api.locale.view');
     $completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $filteredLocales);
     return new JsonResponse($this->compNormalizer->normalize($completenesses, 'internal_api'));
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:25,代码来源:CompletenessController.php

示例7: process

 /**
  * Process form
  *
  * @param  RequestStatus $entity
  *
  * @return bool True on successful processing, false otherwise
  */
 public function process(RequestStatus $entity)
 {
     // always use default locale during template edit in order to allow update of default locale
     $entity->setLocale($this->defaultLocale);
     if ($entity->getId()) {
         // refresh translations
         $this->manager->refresh($entity);
     }
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), ['POST', 'PUT'], true)) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             $this->manager->persist($entity);
             $this->manager->flush();
             return true;
         }
     }
     return false;
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:26,代码来源:RequestStatusHandler.php

示例8: refreshUser

 /**
  * (non-PHPdoc)
  *
  * @see \Symfony\Component\Security\Core\User\UserProviderInterface::refreshUser()
  */
 public function refreshUser(UserInterface $user)
 {
     $userClass = get_class($user);
     if (!$this->supportsClass($userClass)) {
         throw new UnsupportedUserException("Unsupported user '" . $userClass . "'");
     }
     /* @var ADH\UserBundle\Entity\User $user */
     if ($this->entityManager->contains($user)) {
         $this->entityManager->refresh($user);
     } else {
         $user = $this->userRepository->findOneById($user->getId());
     }
     if ($user === null) {
         throw new UsernameNotFoundException("User does not exist.");
     }
     return $user;
 }
开发者ID:Ad-Honorem,项目名称:site,代码行数:22,代码来源:UserManager.php

示例9: createClientAccount

 /**
  * @param ObjectManager $manager
  * @param array $data
  * @param User $clientUser
  * @return ClientAccount
  */
 private function createClientAccount(ObjectManager $manager, array $data, User $clientUser)
 {
     $securityRepository = $manager->getRepository('WealthbotAdminBundle:Security');
     $account = new ClientAccount();
     $account->setClient($clientUser);
     $account->setGroupType($this->getReference('client-account-group-type-' . $data['group_type_key']));
     $account->setFinancialInstitution($data['financial_institution']);
     $account->setValue($data['value']);
     $account->setMonthlyContributions($data['monthly_contributions']);
     $account->setMonthlyDistributions($data['monthly_distributions']);
     $account->setSasCash($data['sas_cash']);
     $account->setProcessStep($data['process_step']);
     $account->setStepAction($data['step_action']);
     $account->setIsPreSaved($data['is_pre_saved']);
     $account->setUnconsolidated($data['unconsolidated']);
     if ($data['consolidator_index']) {
         $consolidator = $clientUser->getClientAccounts()->get($data['consolidator_index'] - 1);
         $account->setConsolidator($consolidator);
     }
     foreach ($data['owners'] as $ownerType) {
         $accountOwner = new ClientAccountOwner();
         if ($ownerType === ClientAccountOwner::OWNER_TYPE_SELF) {
             $accountOwner->setClient($clientUser);
         } else {
             $accountOwner->setContact($clientUser->getAdditionalContacts()->first());
         }
         $accountOwner->setOwnerType($ownerType);
         $accountOwner->setAccount($account);
         $account->addAccountOwner($accountOwner);
     }
     $manager->persist($account);
     $manager->flush();
     $manager->refresh($account);
     if (isset($data['account_contribution'])) {
         $accountContribution = new AccountContribution();
         $accountContribution->setAccount($account);
         $accountContribution->setType($data['account_contribution']['type']);
         $accountContribution->setTransactionFrequency($data['account_contribution']['transaction_frequency']);
         $account->setAccountContribution($accountContribution);
         $manager->persist($accountContribution);
     }
     if (isset($data['securities'])) {
         foreach ($data['securities'] as $securityItem) {
             //ToDo: CE-402. Check that code is not needed more.
             //                $security = $securityRepository->findOneBySymbol($securityItem['symbol']);
             //                if (!$security) {
             //                    /** @var SecurityType $securityType */
             //                    $securityType = $this->getReference('security-type-' . $securityItem['type']);
             //
             //                    $security = new Security();
             //                    $security->setName($securityItem['name']);
             //                    $security->setSymbol($securityItem['symbol']);
             //                    $security->setSecurityType($securityType);
             //                    $security->setExpenseRatio($securityItem['exp_ratio']);
             //                }
             //                $securityAssignment = new SecurityAssignment();
             //                $securityAssignment->setSecurity($security);
             //                $securityAssignment->setRia($clientUser->getRia()); Deprecated
             //                $accountOutsideFund = new AccountOutsideFund();
             //                $accountOutsideFund->setAccount($account);
             //                $accountOutsideFund->setSecurityAssignment($securityAssignment);
             //                $accountOutsideFund->setIsPreferred(false);
             //
             //                $manager->persist($accountOutsideFund);
         }
     }
     $manager->persist($account);
     $manager->flush();
     $this->addReference('client-account-' . $account->getId(), $account);
     return $account;
 }
开发者ID:patrickkb,项目名称:wealthbot,代码行数:77,代码来源:LoadCecRiaData.php

示例10: reloadSite

 /**
  * Reload an site instance.
  *
  * @param Site $site
  */
 public function reloadSite(Site $site)
 {
     $this->objectManager->refresh($site);
 }
开发者ID:alexandre-t,项目名称:pokeme,代码行数:9,代码来源:SiteManager.php

示例11: reloadAnnuaire

 /**
  * Reload an annuaire instance.
  *
  * @param Annuaire $annuaire
  */
 public function reloadAnnuaire(Annuaire $annuaire)
 {
     $this->objectManager->refresh($annuaire);
 }
开发者ID:alexandre-t,项目名称:pokeme,代码行数:9,代码来源:AnnuaireManager.php

示例12: reloadUser

 /**
  * {@inheritdoc}
  */
 public function reloadUser(UserInterface $user)
 {
     $this->objectManager->refresh($user);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:7,代码来源:UserReloader.php

示例13: load

 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $gal = new Folder();
     $gal->setRel('media');
     $gal->setName('Media');
     $gal->setTranslatableLocale('en');
     $manager->persist($gal);
     $manager->flush();
     $this->addReference('media-folder-en', $gal);
     $gal->setTranslatableLocale('nl');
     $manager->refresh($gal);
     $gal->setName('Media');
     $manager->persist($gal);
     $manager->flush();
     $gal->setTranslatableLocale('fr');
     $manager->refresh($gal);
     $gal->setName('Média');
     $manager->persist($gal);
     $manager->flush();
     $subgal = new Folder();
     $subgal->setParent($gal);
     $subgal->setRel('image');
     $subgal->setName('Images');
     $subgal->setTranslatableLocale('en');
     $manager->persist($subgal);
     $manager->flush();
     $this->addReference('images-folder-en', $subgal);
     $subgal->setTranslatableLocale('nl');
     $manager->refresh($subgal);
     $subgal->setName('Afbeeldingen');
     $manager->persist($subgal);
     $manager->flush();
     $subgal->setTranslatableLocale('fr');
     $manager->refresh($subgal);
     $subgal->setName('Images');
     $manager->persist($subgal);
     $manager->flush();
     $subgal = new Folder();
     $subgal->setParent($gal);
     $subgal->setRel('files');
     $subgal->setName('Files');
     $subgal->setTranslatableLocale('en');
     $manager->persist($subgal);
     $manager->flush();
     $this->addReference('files-folder-en', $subgal);
     $subgal->setTranslatableLocale('nl');
     $manager->refresh($subgal);
     $subgal->setName('Bestanden');
     $manager->persist($subgal);
     $manager->flush();
     $subgal->setTranslatableLocale('fr');
     $manager->refresh($subgal);
     $subgal->setName('Fichiers');
     $manager->persist($subgal);
     $manager->flush();
     $subgal = new Folder();
     $subgal->setParent($gal);
     $subgal->setRel('slideshow');
     $subgal->setName('Slides');
     $subgal->setTranslatableLocale('en');
     $manager->persist($subgal);
     $manager->flush();
     $this->addReference('slides-folder-en', $subgal);
     $subgal->setTranslatableLocale('nl');
     $manager->refresh($subgal);
     $subgal->setName('Presentaties');
     $manager->persist($subgal);
     $manager->flush();
     $subgal->setTranslatableLocale('fr');
     $manager->refresh($subgal);
     $subgal->setName('Presentations');
     $manager->persist($subgal);
     $manager->flush();
     $subgal = new Folder();
     $subgal->setParent($gal);
     $subgal->setRel('video');
     $subgal->setName('Videos');
     $subgal->setTranslatableLocale('en');
     $manager->persist($subgal);
     $manager->flush();
     $this->addReference('videos-folder-en', $subgal);
     $subgal->setTranslatableLocale('nl');
     $manager->refresh($subgal);
     $subgal->setName('Video\'s');
     $manager->persist($subgal);
     $manager->flush();
     $subgal->setTranslatableLocale('fr');
     $manager->refresh($subgal);
     $subgal->setName('Vidéos');
     $manager->persist($subgal);
     $manager->flush();
 }
开发者ID:bureaublauwgeel,项目名称:KunstmaanMediaBundle,代码行数:97,代码来源:FolderFixtures.php

示例14: refresh

 /**
  *
  * @access public
  * @param  Object                                                          $entity
  * @return \CCDNForum\ForumBundle\Model\Component\Gateway\GatewayInterface
  */
 public function refresh($entity)
 {
     $this->em->refresh($entity);
     return $this;
 }
开发者ID:wizzbitnl,项目名称:CCDNForumForumBundle,代码行数:11,代码来源:BaseGateway.php

示例15:

 function it_reloads_user(ObjectManager $objectManager, UserInterface $user)
 {
     $objectManager->refresh($user)->shouldBeCalled();
     $this->reloadUser($user);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:5,代码来源:UserReloaderSpec.php


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