Doctrine\ODM\MongoDB\UnitOfWork::isCollectionScheduledForUpdate PHP Method

isCollectionScheduledForUpdate() public method

Checks whether a PersistentCollection is scheduled for update.
public isCollectionScheduledForUpdate ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll ) : boolean
$coll Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface
return boolean
    public function isCollectionScheduledForUpdate(PersistentCollectionInterface $coll)
    {
        return isset($this->collectionUpdates[spl_object_hash($coll)]);
    }

Usage Example

Ejemplo n.º 1
0
 private function getAtomicCollectionUpdateQuery($document)
 {
     $update = array();
     $collections = $this->uow->getScheduledCollections($document);
     $collPersister = $this->uow->getCollectionPersister();
     foreach ($collections as $coll) {
         /* @var $coll PersistentCollection */
         $mapping = $coll->getMapping();
         if ($mapping['strategy'] !== "atomicSet" && $mapping['strategy'] !== "atomicSetArray") {
             continue;
         }
         if ($this->uow->isCollectionScheduledForUpdate($coll)) {
             $update = array_merge_recursive($update, $collPersister->prepareSetQuery($coll));
             $this->uow->unscheduleCollectionUpdate($coll);
             /* TODO:
              * Collection can be set for both deletion and update if
              * PersistentCollection instance was changed. Since we're dealing
              * with collection update in one query we won't need the $unset.
              * Line can be removed once the issue is fixed.
              */
             $this->uow->unscheduleCollectionDeletion($coll);
         } elseif ($this->uow->isCollectionScheduledForDeletion($coll)) {
             $update = array_merge_recursive($update, $collPersister->prepareDeleteQuery($coll));
             $this->uow->unscheduleCollectionDeletion($coll);
         }
     }
     return $update;
 }
All Usage Examples Of Doctrine\ODM\MongoDB\UnitOfWork::isCollectionScheduledForUpdate
UnitOfWork