Fix possible PDO Unknown database error
This patches a possible `Unable to open PDO connection [wrapped: SQLSTATE[42000] [1049] Unknown database '<db_name>']` when the dsn is not ending with a `;`. Related to #159
This commit is contained in:
parent
89e91ad5d4
commit
b61fed529a
2 changed files with 83 additions and 2 deletions
|
|
@ -77,12 +77,12 @@ class DatabaseCreateCommand extends AbstractCommand
|
|||
* @param array $config A Propel connection configuration.
|
||||
* @return array
|
||||
*/
|
||||
private function getTemporaryConfiguration($name, $config)
|
||||
protected function getTemporaryConfiguration($name, $config)
|
||||
{
|
||||
$dbName = $this->parseDbName($config['connection']['dsn']);
|
||||
|
||||
$config['connection']['dsn'] = preg_replace(
|
||||
'#dbname='.$dbName.';#',
|
||||
'#dbname='.$dbName.'(;|$)#',
|
||||
'',
|
||||
$config['connection']['dsn']
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue