diff --git a/src/db-connection/src/Model/Model.php b/src/db-connection/src/Model/Model.php index 15a884635..66ab20881 100644 --- a/src/db-connection/src/Model/Model.php +++ b/src/db-connection/src/Model/Model.php @@ -26,9 +26,8 @@ class Model extends BaseModel */ public function getConnection(): ConnectionInterface { - $connectionName = $this->getConnectionName(); $resolver = ApplicationContext::getContainer()->get(ConnectionResolver::class); - return $resolver->connection($connectionName); + return $resolver->connection($this->getConnectionName()); } public function getEventDispatcher() diff --git a/src/framework/src/Bootstrap/ServerStartCallback.php b/src/framework/src/Bootstrap/ServerStartCallback.php index cc40d7c1d..158a4672a 100644 --- a/src/framework/src/Bootstrap/ServerStartCallback.php +++ b/src/framework/src/Bootstrap/ServerStartCallback.php @@ -11,7 +11,7 @@ declare(strict_types=1); namespace Hyperf\Framework\Bootstrap; -use Hyperf\Framework\Constants\SwooleEvent; +use Hyperf\Framework\SwooleEvent; use Hyperf\Memory; class ServerStartCallback diff --git a/src/framework/src/Bootstrap/WorkerStartCallback.php b/src/framework/src/Bootstrap/WorkerStartCallback.php index ce61446e0..c61794c54 100644 --- a/src/framework/src/Bootstrap/WorkerStartCallback.php +++ b/src/framework/src/Bootstrap/WorkerStartCallback.php @@ -12,7 +12,7 @@ declare(strict_types=1); namespace Hyperf\Framework\Bootstrap; use Hyperf\Di\Container; -use Hyperf\Framework\Constants\SwooleEvent; +use Hyperf\Framework\SwooleEvent; use Hyperf\Framework\Contract\StdoutLoggerInterface; use Hyperf\Memory\AtomicManager; use Hyperf\Memory\LockManager; diff --git a/src/framework/src/Server.php b/src/framework/src/Server.php index 0da158dc7..2703240f0 100644 --- a/src/framework/src/Server.php +++ b/src/framework/src/Server.php @@ -13,7 +13,6 @@ namespace Hyperf\Framework; use Hyperf\Contract\ProcessInterface; use Hyperf\Contract\ServerOnRequestInterface; -use Hyperf\Framework\Constants\SwooleEvent; use Hyperf\Framework\Contract\StdoutLoggerInterface; use InvalidArgumentException; use Psr\Container\ContainerInterface; diff --git a/src/framework/src/Constants/SwooleEvent.php b/src/framework/src/SwooleEvent.php similarity index 95% rename from src/framework/src/Constants/SwooleEvent.php rename to src/framework/src/SwooleEvent.php index 681df679b..c956adadb 100644 --- a/src/framework/src/Constants/SwooleEvent.php +++ b/src/framework/src/SwooleEvent.php @@ -9,7 +9,7 @@ declare(strict_types=1); * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE */ -namespace Hyperf\Framework\Constants; +namespace Hyperf\Framework; class SwooleEvent {