當前位置: 首頁>>代碼示例>>PHP>>正文


PHP RegistryInterface::flush方法代碼示例

本文整理匯總了PHP中Symfony\Bridge\Doctrine\RegistryInterface::flush方法的典型用法代碼示例。如果您正苦於以下問題:PHP RegistryInterface::flush方法的具體用法?PHP RegistryInterface::flush怎麽用?PHP RegistryInterface::flush使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Bridge\Doctrine\RegistryInterface的用法示例。


在下文中一共展示了RegistryInterface::flush方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onSuccess

 /**
  * "Success" form handler
  *
  * @param Cart $entity
  */
 protected function onSuccess(Cart $entity)
 {
     $count = 0;
     /** @var CartItem $item */
     foreach ($entity->getCartItems() as $item) {
         $item->setCart($entity);
         ++$count;
     }
     $entity->setItemsCount($count);
     if (null === $entity->getOrganization()) {
         $entity->setOrganization($this->organization);
     }
     if ($entity->getShippingAddress() instanceof AbstractAddress && null === $entity->getShippingAddress()->getOrganization()) {
         $entity->getShippingAddress()->setOrganization($this->organization);
     }
     if ($entity->getBillingAddress() instanceof AbstractAddress && null === $entity->getBillingAddress()->getOrganization()) {
         $entity->getBillingAddress()->setOrganization($this->organization);
     }
     $this->manager->persist($entity);
     $this->manager->flush();
 }
開發者ID:antrampa,項目名稱:crm,代碼行數:26,代碼來源:CartHandler.php

示例2: onSuccess

 /**
  * "Success" form handler
  *
  * @param Order $entity
  */
 protected function onSuccess(Order $entity)
 {
     if (null === $entity->getOrganization()) {
         $entity->setOrganization($this->organization);
     }
     /** @var OrderAddress $address */
     foreach ($entity->getAddresses() as $address) {
         if (null === $address->getOwner()) {
             $address->setOwner($entity);
         }
         if (null === $address->getOrganization()) {
             $address->setOrganization($this->organization);
         }
     }
     /** @var OrderItem $item */
     foreach ($entity->getItems() as $item) {
         if (null === $item->getOrder()) {
             $item->setOrder($entity);
         }
     }
     $this->manager->persist($entity);
     $this->manager->flush();
 }
開發者ID:antrampa,項目名稱:crm,代碼行數:28,代碼來源:OrderHandler.php

示例3: onSuccess

 /**
  * "Success" form handler
  *
  * @param CartItem $entity
  */
 protected function onSuccess(CartItem $entity)
 {
     $this->manager->persist($entity);
     $this->manager->flush();
 }
開發者ID:antrampa,項目名稱:crm,代碼行數:10,代碼來源:CartItemHandler.php


注:本文中的Symfony\Bridge\Doctrine\RegistryInterface::flush方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。