src/Command/DropDatabaseDoctrineCommand.php
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $connectionName = $this->getConnectionName($input);

        $connection = $this->connectionRegistry->getConnection($connectionName);

        $params = $this->getParams($connection);

        $dbName = $this->getDbName($params, $connectionName);

        if (!$input->getOption('force')) {
            $this->writeMissingForceOutput($output, $dbName, $connectionName);

            return self::RETURN_CODE_NO_FORCE;
        }

        $isPath = isset($params['path']);

        $ifExists = $input->getOption('if-exists');

        // Need to get rid of _every_ occurrence of dbname from connection configuration
        unset($params['dbname'], $params['path'], $params['url']);

        $connection->close();
        $connection = DriverManager::getConnection($params);
        $shouldDropDatabase = !$ifExists || in_array($dbName, $connection->getSchemaManager()->listDatabases());

        // Only quote if we don't have a path
        if (!$isPath) {
            $dbName = $connection->getDatabasePlatform()->quoteSingleIdentifier($dbName);
        }

        return $this->dropDatabase($output, $connectionName, $connection, $dbName, $shouldDropDatabase);
    }
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $connectionName = $this->getConnectionName($input);

        $connection = $this->connectionRegistry->getConnection($connectionName);

        $params = $this->getParams($connection);

        $dbName = $this->getDbName($params, $connectionName);

        if (!$input->getOption('force')) {
            $this->writeMissingForceOutput($output, $dbName, $connectionName);

            return self::RETURN_CODE_NO_FORCE;
        }

        $isPath = isset($params['path']);

        $ifExists = $input->getOption('if-exists');

        // Need to get rid of _every_ occurrence of dbname from connection configuration
        unset($params['dbname'], $params['path'], $params['url']);

        $connection->close();
        $connection = DriverManager::getConnection($params);
        $shouldDropDatabase = !$ifExists || in_array($dbName, $connection->getSchemaManager()->listDatabases());

        // Only quote if we don't have a path
        if (!$isPath) {
            $dbName = $connection->getDatabasePlatform()->quoteSingleIdentifier($dbName);
        }

        return $this->dropDatabase($output, $connectionName, $connection, $dbName, $shouldDropDatabase);
    }
@param InputInterface  $input
@param OutputInterface $output

@return int