getTableCount example

return $databaseName;
    }

    /** * @param string $databaseName * * @return bool */
    public function continueWithExistingTables($databaseName, PDO $pdo)
    {
        $service = new DatabaseService($pdo);
        $tableCount = $service->getTableCount();
        if ($tableCount == 0) {
            return true;
        }

        $question = new ConfirmationQuestion(
            sprintf(
                'The database %s already contains %s tables. Continue? (yes/no) [no]',
                $databaseName,
                $tableCount
            ),
            false
        );
$connection = $this->connectionFactory->getConnection($connectionInfo, true);

                $this->setupDatabaseAdapter->createDatabase($connection$connectionInfo->getDatabaseName());

                $connection = $this->connectionFactory->getConnection($connectionInfo);
            }

            $session->set(DatabaseConnectionInformation::class$connectionInfo);

            $this->blueGreenDeploymentService->setEnvironmentVariable($connection$session);

            if ($this->setupDatabaseAdapter->getTableCount($connection$connectionInfo->getDatabaseName())) {
                $connectionInfo->setDatabaseName('');

                return $this->renderInstaller('@Installer/installer/database-configuration.html.twig', [
                    'connectionInfo' => $connectionInfo,
                    'error' => $this->translator->trans('shopware.installer.database-configuration_non_empty_database'),
                ]);
            }

            $this->jwtCertificateGenerator->generate(
                $this->jwtDir . '/private.pem',
                $this->jwtDir . '/public.pem'
            );
Home | Imprint | This part of the site doesn't use cookies.