Thanks to visit codestin.com
Credit goes to github.com

Skip to content

No database connection #60804

Closed as not planned
Closed as not planned
@4d4ch4u32

Description

@4d4ch4u32

Symfony version(s) affected

7.3.0

Description

$this->entityManager->getConnection()->isConnected() is false.

Constructor of the service:

    public function __construct(
        private readonly SettingsRepository $settingsRepository,
        private readonly EntityManagerInterface $entityManager,
    ) {
    }

How to reproduce

I assume this only occurs on the application's login page.

SecurityController.php:

class SecurityController extends AbstractController
{
    public function __construct(
        private readonly SettingsService $settingsService,
    ) {
    }

    #[Route(path: '/login', name: 'app_login')]
    public function login(AuthenticationUtils $authenticationUtils): Response
    {
        $error = $authenticationUtils->getLastAuthenticationError();
        $lastUsername = $authenticationUtils->getLastUsername();

        $clientDisplayName = $this->settingsService->getSettings(SettingsService::KEY_CLIENT_DISPLAY_NAME['key']);

        $params = [
            'error'                   => $error,
            'last_username'           => $lastUsername,
        ];

        return $this->render('login.html.twig', $params);
    }

Possible Solution

No response

Additional Context

composer info | grep doctrine
dama/doctrine-test-bundle                      8.3.0     Symfony bundle to isolate doctrine database tests and improve test pe...
doctrine/annotations                           1.14.4    Docblock Annotations Parser
doctrine/cache                                 2.2.0     PHP Doctrine Cache library is a popular cache implementation that sup...
doctrine/collections                           2.3.0     PHP Doctrine Collections library that adds additional functionality o...
doctrine/common                                3.5.0     PHP Doctrine Common project is a library that provides additional fun...
doctrine/data-fixtures                         2.0.2     Data Fixtures for all Doctrine Object Managers
doctrine/dbal                                  3.9.4     Powerful PHP database abstraction layer (DBAL) with many features for...
doctrine/deprecations                          1.1.5     A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 log...
doctrine/doctrine-bundle                       2.14.0    Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle              4.1.0     Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle            3.4.2     Symfony DoctrineMigrationsBundle
doctrine/event-manager                         2.0.1     The Doctrine Event Manager is a simple PHP event system that was buil...
doctrine/inflector                             2.0.10    PHP Doctrine Inflector is a small library that can perform string man...
doctrine/instantiator                          2.0.0     A small, lightweight utility to instantiate objects in PHP without in...
doctrine/lexer                                 2.1.1     PHP Doctrine Lexer parser library that can be used in Top-Down, Recur...
doctrine/migrations                            3.9.0     PHP Doctrine Migrations project offer additional functionality on top...
doctrine/orm                                   2.20.3    Object-Relational-Mapper for PHP
doctrine/persistence                           3.4.0     The Doctrine Persistence project is a set of shared interfaces and fu...
doctrine/sql-formatter                         1.5.2     a PHP SQL highlighting library
oro/doctrine-extensions                        2.0.5     Doctrine Extensions for MySQL and PostgreSQL.
phpstan/phpstan-doctrine                       2.0.3     Doctrine extensions for PHPStan
symfony/doctrine-bridge                        7.3.0     Provides integration for Doctrine with various Symfony components
symfony/doctrine-messenger                     7.3.0     Symfony Doctrine Messenger Bridge

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions