ask information connection again if they are wrong
This commit is contained in:
@@ -51,11 +51,9 @@ class Install extends ContainerAwareCommand
|
|||||||
''
|
''
|
||||||
));
|
));
|
||||||
|
|
||||||
$connectionInfo = $this->getConnectionInfo($input, $output);
|
do {
|
||||||
|
$connectionInfo = $this->getConnectionInfo($input, $output);
|
||||||
if (false === $connection = $this->tryConnection($connectionInfo)) {
|
} while(false === $connection = $this->tryConnection($connectionInfo, $output));
|
||||||
throw new \RuntimeException("Wrong information, impossible to connect to database");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->createDatabase($connection, $connectionInfo["dbName"]);
|
$this->createDatabase($connection, $connectionInfo["dbName"]);
|
||||||
|
|
||||||
@@ -153,7 +151,7 @@ class Install extends ContainerAwareCommand
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tryConnection($connectionInfo)
|
protected function tryConnection($connectionInfo, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
|
||||||
$dsn = "mysql:host=%s";
|
$dsn = "mysql:host=%s";
|
||||||
@@ -165,6 +163,9 @@ class Install extends ContainerAwareCommand
|
|||||||
$connectionInfo["password"]
|
$connectionInfo["password"]
|
||||||
);
|
);
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
|
$output->writeln(array(
|
||||||
|
"<error>Wrong connection information</error>"
|
||||||
|
));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user