getScheduledCollectionUpdates() public method

Gets the currently scheduled collection inserts, updates and deletes.
 /**
  * @return array|CustomerIdentityInterface[]
  */
 protected function getChangedTrackedEntities()
 {
     $entities = array_merge($this->uow->getScheduledEntityInsertions(), $this->uow->getScheduledEntityDeletions(), $this->uow->getScheduledEntityUpdates());
     $collections = array_merge($this->uow->getScheduledCollectionDeletions(), $this->uow->getScheduledCollectionUpdates());
     /** @var PersistentCollection $collectionToChange */
     foreach ($collections as $collectionToChange) {
         $entities = array_merge($entities, $collectionToChange->unwrap()->toArray());
     }
     return array_filter($entities, function ($entity) {
         return $entity instanceof CustomerIdentityInterface && array_key_exists(ClassUtils::getClass($entity), $this->customerIdentities);
     });
 }
Example #2
0
 /**
  * @param UnitOfWork $uow
  * @return array|Order[]
  */
 protected function getChangedOrders(UnitOfWork $uow)
 {
     $entities = array_merge($uow->getScheduledEntityInsertions(), $uow->getScheduledEntityDeletions(), $uow->getScheduledEntityUpdates());
     $collections = array_merge($uow->getScheduledCollectionDeletions(), $uow->getScheduledCollectionUpdates());
     /** @var PersistentCollection $collectionToChange */
     foreach ($collections as $collectionToChange) {
         $entities = array_merge($entities, $collectionToChange->unwrap()->toArray());
     }
     return array_filter($entities, function ($entity) {
         return $this->isOrderValid($entity);
     });
 }
Example #3
0
 /**
  * Collect updated activities owner entities
  *
  * @param UnitOfWork $uof
  */
 protected function collectUpdatesOwnerEntities(UnitOfWork $uof)
 {
     $entities = $uof->getScheduledEntityUpdates();
     foreach ($entities as $hash => $entity) {
         if ($this->activityListManager->isSupportedOwnerEntity($entity) && empty($this->updatedOwnerEntities[$hash])) {
             $this->updatedOwnerEntities[$hash] = $entity;
         }
     }
     $updatedCollections = array_merge($uof->getScheduledCollectionUpdates(), $uof->getScheduledCollectionDeletions());
     foreach ($updatedCollections as $hash => $collection) {
         /** @var $collection PersistentCollection */
         $ownerEntity = $collection->getOwner();
         $entityHash = spl_object_hash($ownerEntity);
         if ($this->activityListManager->isSupportedOwnerEntity($ownerEntity) && $this->doctrineHelper->getSingleEntityIdentifier($ownerEntity) !== null && empty($this->updatedOwnerEntities[$entityHash])) {
             $this->updatedOwnerEntities[$entityHash] = $ownerEntity;
         }
     }
 }