Skip to content

Commit

Permalink
Adding getDriver to repository
Browse files Browse the repository at this point in the history
  • Loading branch information
nilportugues committed Aug 9, 2016
1 parent d790334 commit 93f553f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ All the methods listed under MongoDBWriteRepository, MongoDBReadRepository and M
- `public function transactional(callable $transaction)`
- `public function count(Filter $filter = null)`
- `public function exists(Identity $id)`
- `public function getDriver()`

### Available in MongoDBReadRepository

Expand All @@ -266,12 +267,14 @@ All the methods listed under MongoDBWriteRepository, MongoDBReadRepository and M
- `public function findByDistinct(Fields $distinctFields, Filter $filter = null, Sort $sort = null, Fields $fields = null)`
- `public function count(Filter $filter = null)`
- `public function exists(Identity $id)`
- `public function getDriver()`

### Available in MongoDBPageRepository

- `public function findAll(Pageable $pageable = null)`
- `public function count(Filter $filter = null)`
- `public function exists(Identity $id)`
- `public function getDriver()`

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ public static function create(Mapping $mapping, Client $client, $databaseName, $
return new static($mapping, $client, $databaseName, $collectionName, $options);
}

/**
* @return \MongoDB\Collection
*/
public function getDriver()
{
return $this->getCollection();
}

/**
* @return \MongoDB\Collection
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ public function __construct(Mapping $mapping, Client $client, $databaseName, $co
);
}

/**
* @return \MongoDB\Collection
*/
public function getDriver()
{
return $this->readRepository->getDriver();
}

/**
* Returns the total amount of elements in the repository given the restrictions provided by the Filter object.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public function setUp()
$this->repository->addAll([$client1, $client2, $client3, $client4]);
}


public function testGetDriver()
{
$this->assertInstanceOf('\MongoDB\Collection', $this->repository->getDriver());
}

public function testItCanUpdateAnExistingClient()
{
$client1 = new Clients(1, 'Homer Simpson', new DateTime('2014-12-11'), 3, 25.125);
Expand Down

0 comments on commit 93f553f

Please sign in to comment.