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

add() public method

public add ( $value )
    public function add($value)
    {
        $this->coll->add($value);
        $this->changed();
        return true;
    }

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::add