swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 788 forks source link

Call to undefined method Swoft\Db\Database::getDatabase() #1499

Closed wqjohnston closed 1 year ago

wqjohnston commented 1 year ago
Q A
Bug report? yes/no
Feature request? yes/no
Swoft version v2.0.11
Swoole version 4.4.18
PHP version PHP 7.2.34 (cli)
Runtime environment docker

Describe the bug A clear and concise description of what the bug is.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Details

Describe what you are trying to achieve and what goes wrong.

[ERROR] App\Exception\Handler\HttpExceptionHandler:handle(40) Call to undefined method Swo ft\Db\Database::getDatabase(). (At /var/www/swoft/vendor/swoft/db/src/Query/Builder.php line 3393)

// paste output here

Provide minimal script to reproduce the issue

// paste code

$all = DB::query('swoftdb')->getConnection()->selectOne();