依赖
This commit is contained in:
parent
a8310d9d25
commit
b017b7ee89
|
@ -9,9 +9,11 @@
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.2",
|
"php": ">=7.2",
|
||||||
|
"hyperf/framework": "~2.1.0",
|
||||||
"psr/container": "^1.0",
|
"psr/container": "^1.0",
|
||||||
"hyperf/pool": "^2.0",
|
"hyperf/pool": "^2.0",
|
||||||
"hyperf/utils": "^2.0.0",
|
"hyperf/utils": "^2.0.0",
|
||||||
|
"hyperf/di": "^2.0.0",
|
||||||
"ext-mongodb": "*"
|
"ext-mongodb": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
namespace Hyperf\Mongodb\Pool;
|
namespace Hyperf\Mongodb\Pool;
|
||||||
|
|
||||||
use Hyperf\Di\Container;
|
use Hyperf\Di\Container;
|
||||||
|
use Hyperf\Di\Exception\NotFoundException;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use Swoole\Coroutine\Channel;
|
use Swoole\Coroutine\Channel;
|
||||||
|
|
||||||
|
@ -24,7 +25,10 @@ class PoolFactory
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPool(string $name): MongoDBPool
|
/**
|
||||||
|
* @throws NotFoundException
|
||||||
|
*/
|
||||||
|
public function getPool(string $name): Channel
|
||||||
{
|
{
|
||||||
if (isset($this->pools[$name])) {
|
if (isset($this->pools[$name])) {
|
||||||
return $this->pools[$name];
|
return $this->pools[$name];
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace Zyimm\Test;
|
||||||
|
|
||||||
class MongoTest extends \PHPUnit\Framework\TestCase
|
class MongoTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testfindALL()
|
public function testFindALL()
|
||||||
{
|
{
|
||||||
$this->assertArrayHasKey('error_code', Sdk::instance($this->config())
|
$this->assertArrayHasKey('error_code', Sdk::instance($this->config())
|
||||||
->service()
|
->service()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user