Skip to content

Commit 998b3f1

Browse files
authored
Update GenerateDocumentCommand.php
1 parent 9812f86 commit 998b3f1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/DocumentBundle/Command/GenerateDocumentCommand.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@ private function globalConfig()
110110
}
111111
}
112112

113-
$this->config['database_host'] = $this->connection->getHost();
114-
$this->config['database_name'] = $this->connection->getDatabase();
115-
$this->config['database_user_name'] = $this->connection->getUsername();
116-
$this->config['database_password'] = $this->connection->getPassword();
113+
$this->config['database_host'] = $this->connection->getParams()['host'];
114+
$this->config['database_port'] = $this->connection->getParams()['port'];
115+
$this->config['database_name'] = $this->connection->getParams()['dbname'];
116+
$this->config['database_user_name'] = $this->connection->getParams()['user'];
117+
$this->config['database_password'] = $this->connection->getParams()['password'];
117118

118119
if(empty($global['title'])) {
119120
$this->io->error('文档标题不能为空');
@@ -977,9 +978,10 @@ function generateDataFile()
977978
//配置数据库
978979
$database = $config['database_name'];
979980
$dbserver = $config['database_host'];
981+
$dpord = $config['database_port'];
980982
$dbusername = $config['database_user_name'];
981983
$dbpassword = $config['database_password'];
982-
$mysql_conn = mysqli_connect("$dbserver", "$dbusername", "$dbpassword");
984+
$mysql_conn = mysqli_connect("$dbserver", "$dbusername", "$dbpassword", null, $dpord);
983985
if (!$mysql_conn) {
984986
$data_html .= '<div class="not-found">数据库连接失败</div>';
985987
} else {

0 commit comments

Comments
 (0)