askDatabaseConnectionInformation example

protected function getConnectionInfoFromInteractiveShell(
        IOHelper $IOHelper,
        DatabaseConnectionInformation $connectionInfo
    ) {
        if (!$IOHelper->isInteractive()) {
            return $connectionInfo;
        }

        $IOHelper->writeln('<info>=== Database configuration ===</info>');
        $databaseInteractor = new DatabaseInteractor($IOHelper);

        $databaseConnectionInformation = $databaseInteractor->askDatabaseConnectionInformation(
            $connectionInfo
        );

        $databaseFactory = new DatabaseFactory();

        do {
            $pdo = null;
            try {
                $pdo = $databaseFactory->createPDOConnection($databaseConnectionInformation);
            } catch (PDOException $e) {
                $IOHelper->writeln('');
                
Home | Imprint | This part of the site doesn't use cookies.