Skip to content

Commit

Permalink
Add missing UnitOfWork::getScheduledDocumentUpserts() method. Fixes i…
Browse files Browse the repository at this point in the history
…ssue reported by @mlively
  • Loading branch information
jwage committed Jan 27, 2014
1 parent 86cd699 commit 505ad37
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Doctrine/ODM/MongoDB/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -2988,6 +2988,16 @@ public function getScheduledDocumentInsertions()
return $this->documentInsertions;
}

/**
* Gets the currently scheduled document upserts in this UnitOfWork.
*
* @return array
*/
public function getScheduledDocumentUpserts()
{
return $this->documentUpserts;
}

/**
* Gets the currently scheduled document updates in this UnitOfWork.
*
Expand Down
10 changes: 10 additions & 0 deletions tests/Doctrine/ODM/MongoDB/Tests/UnitOfWorkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ public function testScheduleForUpsert()
$this->assertTrue($this->uow->isScheduledForUpsert($user));
}

public function testGetScheduledDocumentUpserts()
{
$class = $this->dm->getClassMetadata('Documents\ForumUser');
$user = new ForumUser();
$user->id = new \MongoId();
$this->assertEmpty($this->uow->getScheduledDocumentUpserts());
$this->uow->scheduleForUpsert($class, $user);
$this->assertEquals(array(spl_object_hash($user) => $user), $this->uow->getScheduledDocumentUpserts());
}

public function testScheduleForEmbeddedUpsert()
{
$class = $this->dm->getClassMetadata('Documents\ForumUser');
Expand Down

0 comments on commit 505ad37

Please sign in to comment.