Skip to content

Commit

Permalink
Merge pull request #151 from leroy-merlin-br/chore/update-mongolid-ve…
Browse files Browse the repository at this point in the history
…rsion-3

Update mongolid version 3
  • Loading branch information
ezandonai committed Jul 15, 2022
2 parents e0f9d6e + 06d092d commit e193a3b
Show file tree
Hide file tree
Showing 20 changed files with 2,239 additions and 1,189 deletions.
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,10 @@
"MongoLid": "MongolidLaravel\\MongolidModel"
}
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
1,984 changes: 1,119 additions & 865 deletions composer.lock

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions src/FailedJobsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use MongoDB\DeleteResult;
use MongoDB\Driver\Cursor;
use MongoDB\InsertOneResult;
use Mongolid\Connection\Pool;
use Mongolid\Connection\Connection;

/**
* Persistence layer that is used to save failed queue jobs on MongoDB.
Expand All @@ -23,17 +23,17 @@ class FailedJobsService
/**
* Connections that are going to be used to interact with database.
*
* @var Pool
* @var Connection
*/
protected $connPool;
protected $connection;

/**
* @param Pool $connPool Connections that are going to be used to interact with MongoDB
* @param string $collection Collection where jobs will be stored
* @param Connection $connection Connections that are going to be used to interact with MongoDB
* @param string $collection Collection where jobs will be stored
*/
public function __construct(Pool $connPool, string $collection = 'failed_jobs')
public function __construct(Connection $connection, string $collection = 'failed_jobs')
{
$this->connPool = $connPool;
$this->connection = $connection;
$this->collection = $collection;
}

Expand Down Expand Up @@ -88,9 +88,8 @@ public function drop()
*/
protected function rawCollection(): Collection
{
$conn = $this->connPool->getConnection();
$database = $conn->defaultDatabase;
$database = $this->connection->defaultDatabase;

return $conn->getRawConnection()->$database->{$this->collection};
return $this->connection->getClient()->$database->{$this->collection};
}
}
Loading

0 comments on commit e193a3b

Please sign in to comment.