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

getVisitedCollections() public method

INTERNAL: Gets PersistentCollections that have been visited during computing change set of $document
public getVisitedCollections ( object $document ) : Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface[]
$document object
return Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface[]
    public function getVisitedCollections($document)
    {
        $oid = spl_object_hash($document);
        return isset($this->visitedCollections[$oid]) ? $this->visitedCollections[$oid] : array();
    }

Usage Example

Ejemplo n.º 1
0
 private function handleCollections($document, $options)
 {
     // Collection deletions (deletions of complete collections)
     foreach ($this->uow->getScheduledCollections($document) as $coll) {
         if ($this->uow->isCollectionScheduledForDeletion($coll)) {
             $this->cp->delete($coll, $options);
         }
     }
     // Collection updates (deleteRows, updateRows, insertRows)
     foreach ($this->uow->getScheduledCollections($document) as $coll) {
         if ($this->uow->isCollectionScheduledForUpdate($coll)) {
             $this->cp->update($coll, $options);
         }
     }
     // Take new snapshots from visited collections
     foreach ($this->uow->getVisitedCollections($document) as $coll) {
         $coll->takeSnapshot();
     }
 }
UnitOfWork