Doctrine\ODM\MongoDB\PersistentCollection::takeSnapshot PHP Method

takeSnapshot() public method

INTERNAL: Tells this collection to take a snapshot of its current state.
public takeSnapshot ( )
    public function takeSnapshot()
    {
        $this->snapshot = $this->coll->toArray();
        $this->isDirty = false;
    }

Usage Example

 /**
  * @param array $expected
  * @param array $snapshot
  * @param \Closure $callback
  *
  * @dataProvider dataGetDeletedDocuments
  */
 public function testGetDeletedDocuments($expected, $snapshot, \Closure $callback)
 {
     $collection = new PersistentCollection(new ArrayCollection(), $this->getMockDocumentManager(), $this->getMockUnitOfWork());
     foreach ($snapshot as $item) {
         $collection->add($item);
     }
     $collection->takeSnapshot();
     $callback($collection);
     $this->assertSame($expected, $collection->getDeletedDocuments());
 }
All Usage Examples Of Doctrine\ODM\MongoDB\PersistentCollection::takeSnapshot