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


PHP UnitOfWork::isScheduledForUpdate方法代碼示例

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


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

示例1: onFlush

 /**
  * @param OnFlushEventArgs $args
  */
 public function onFlush(OnFlushEventArgs $args)
 {
     $this->initializeFromEventArgs($args);
     $entities = array_merge($this->uow->getScheduledEntityInsertions(), $this->uow->getScheduledEntityDeletions(), $this->uow->getScheduledEntityUpdates());
     /** @var Opportunity[] $entities */
     $entities = array_filter($entities, function ($entity) {
         return 'OroCRM\\Bundle\\SalesBundle\\Entity\\Opportunity' === ClassUtils::getClass($entity);
     });
     foreach ($entities as $entity) {
         if (!$entity->getId() && $this->isValuable($entity)) {
             // handle creation, just add to prev lifetime value and recalculate change set
             $b2bCustomer = $entity->getCustomer();
             $b2bCustomer->setLifetime($b2bCustomer->getLifetime() + $entity->getCloseRevenue());
             $this->scheduleUpdate($b2bCustomer);
             $this->uow->computeChangeSet($this->em->getClassMetadata(ClassUtils::getClass($b2bCustomer)), $b2bCustomer);
         } elseif ($this->uow->isScheduledForDelete($entity) && $this->isValuable($entity)) {
             $this->scheduleUpdate($entity->getCustomer());
         } elseif ($this->uow->isScheduledForUpdate($entity)) {
             // handle update
             $changeSet = $this->uow->getEntityChangeSet($entity);
             if ($this->isChangeSetValuable($changeSet)) {
                 if (!empty($changeSet['customer']) && $changeSet['customer'][0] instanceof B2bCustomer && B2bCustomerRepository::VALUABLE_STATUS === $this->getOldStatus($entity, $changeSet)) {
                     // handle change of b2b customer
                     $this->scheduleUpdate($changeSet['customer'][0]);
                 }
                 if ($this->isValuable($entity, isset($changeSet['closeRevenue'])) || B2bCustomerRepository::VALUABLE_STATUS === $this->getOldStatus($entity, $changeSet) && $entity->getCustomer()) {
                     $this->scheduleUpdate($entity->getCustomer());
                 }
             }
         }
     }
 }
開發者ID:antrampa,項目名稱:crm,代碼行數:35,代碼來源:B2bCustomerLifetimeListener.php

示例2: onFlush

 /**
  * @param OnFlushEventArgs $args
  */
 public function onFlush(OnFlushEventArgs $args)
 {
     $this->initializeFromEventArgs($args);
     $entities = $this->getChangedTrackedEntities();
     foreach ($entities as $entity) {
         $className = ClassUtils::getClass($entity);
         if ($this->uow->isScheduledForUpdate($entity)) {
             $this->checkAndUpdate($entity, $this->uow->getEntityChangeSet($entity));
         } else {
             $this->scheduleUpdate($className, $entity->getAccount(), $entity->getDataChannel());
         }
     }
 }
開發者ID:hugeval,項目名稱:crm,代碼行數:16,代碼來源:ChannelDoctrineListener.php


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