scheduleOrphanRemoval() public method

INTERNAL: Schedules an embedded document for removal. The remove() operation will be invoked on that document at the beginning of the next commit of this UnitOfWork.
public scheduleOrphanRemoval ( object $document )
$document object
 /**
  * {@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();
 }
 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     if ($this->initialized && $this->isEmpty()) {
         return;
     }
     if ($this->isOrphanRemovalEnabled()) {
         foreach ($this->coll as $element) {
             $this->uow->scheduleOrphanRemoval($element);
         }
     }
     $this->mongoData = array();
     $this->coll->clear();
     if ($this->mapping['isOwningSide']) {
         $this->changed();
         $this->uow->scheduleCollectionDeletion($this);
         $this->takeSnapshot();
     }
 }