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

scheduleCollectionDeletion() public method

INTERNAL: Schedules a complete collection for removal when this UnitOfWork commits.
public scheduleCollectionDeletion ( Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface $coll )
$coll Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface
    public function scheduleCollectionDeletion(PersistentCollectionInterface $coll)
    {
        $oid = spl_object_hash($coll);
        unset($this->collectionUpdates[$oid]);
        if (!isset($this->collectionDeletions[$oid])) {
            $this->collectionDeletions[$oid] = $coll;
            $this->scheduleCollectionOwner($coll);
        }
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     if ($this->initialized && $this->isEmpty()) {
         return;
     }
     if ($this->isOrphanRemovalEnabled()) {
         $this->initialize();
         foreach ($this->coll as $element) {
             $this->uow->scheduleOrphanRemoval($element);
         }
     }
     $this->mongoData = array();
     $this->coll->clear();
     // Nothing to do for inverse-side collections
     if (!$this->mapping['isOwningSide']) {
         return;
     }
     // Nothing to do if the collection was initialized but contained no data
     if ($this->initialized && empty($this->snapshot)) {
         return;
     }
     $this->changed();
     $this->uow->scheduleCollectionDeletion($this);
     $this->takeSnapshot();
 }
All Usage Examples Of Doctrine\ODM\MongoDB\UnitOfWork::scheduleCollectionDeletion
UnitOfWork