DoctrineBundle: Doctrine DBAL 2.5 Breaks Symfony if DB Doesn't Exist

After updating to DBAL 2.5, Doctrine introduced Doctrine\DBAL\Connection::detectDatabasePlatform() which is different than 2.4. Now in 2.5, any time a repository is instantiated (not even used) by the DI, we get a PDOException if the DB doesn’t already exist.

Imagine trying to run app/console doctrine:database:create and getting a “Database doesn’t exist!” error. Repositories as services are very common in most projects, so this is a huge issue.

To illustrate quickly, create a fresh Symfony project, letting composer install the AcmeDemoBundle. Then, while trying to generate an entity, you’ll get the PDOException.

composer create-project symfony/framework-standard-edition symfony-standard
cd symfony-standard
app/console doctrine:generate:entity --entity=AcmeDemoBundle:Foo
  [Doctrine\DBAL\Exception\ConnectionException]
  An exception occured in driver: SQLSTATE[HY000] [1049] Unknown database 'testdb'

  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[HY000] [1049] Unknown database 'testdb'

  [PDOException]
  SQLSTATE[HY000] [1049] Unknown database 'testdb'

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 108 (77 by maintainers)

Commits related to this issue

Most upvoted comments

For know you can simply provide the version of the database server you are connecting to like this:

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                dbname:   Symfony2
                user:         root
                password: null
                host:         localhost
                driver:       pdo_mysql
                server_version: 5.6 # your database server version here

As a workaround until we find a solution.

@stof sorry to add more comments about this, but I’d like to say that:

  • Before DBAL 2.5 we didn’t configure the server_version and our apps worked perfectly.
  • Executing cache:clear and getting database connection errors makes Symfony look stupid and buggy (and it’s not even Symfony’s fault!)

I’m seeing lots of problems related to this on Travis, while deploying apps, etc. That’s why I think this is a Doctrine bug that must be fixed.

From what I understand, I problem come from the experience of using symfony (from scratch), so more usually from Symfony Standard Edition.

Given the advantage of specifying the version of the database, why not simply add a parameter in the app/config/parameters.yml file?

That which would give in the file app/config/config.yml:

doctrine:
    dbal:
        driver: "%database_driver%"
        server_version: "%database_server_version%"
        # ...

and in the file app/config/parameters.yml.dist:

parameters:
    database_driver: pdo_mysql
    database_server_version: 5.5
    # ...

With the dependency incenteev/composer-parameter-handler (already required), the configuration can be changed at the Symfony Standard Edition installation.

Is not that a good compromise?

Just set your db version? It’s not hard and it saves you a query per request.

On 9 Mar 2017 3:38 a.m., “Dalibor Karlović” notifications@github.com wrote:

@Ocramius https://github.com/Ocramius in that case, 5.7 is more strict, use that as “lowest common denominator”? I just feel being in a state where you cannot create a DB because you don’t have a DB is wrong and hurtful to experience of new Symfony+Doctrine developers.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/doctrine/DoctrineBundle/issues/351#issuecomment-285288648, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakDWoFFDtvRpcPXlD_f_8D58e0a83ks5rj7qjgaJpZM4DEmKk .

Also, connecting to the database while just getting a repository seems overkill IMO… getRepository should return a newly instanciated repository class, but any access to the database (or any other costly operation) should happen later, when using the repository.

@kimhemsoe if so, why doesn’t getPlatform() assume the lowest common denominator?

In the meantime, Symfony standard edition could just ship with a MySQL version set as it does assume MySQL already.

@Soullivaneuh @greg0ire https://github.com/doctrine/DoctrineBundle/issues/561#issuecomment-238904950

Short story, if “getPlatform*” is called at any point and the driver does not know the version, it will try to detect the version.

In the beginning of dbal, there was only one platform per vendor. This have changed but the usage pattern of platforms have not.

@stof sure! First, the relevant package versions used by this app:

$ composer show

doctrine/annotations                 v1.2.7             Docblock Annotations Parser
doctrine/cache                       v1.6.0             Caching library offering an object-oriented API for many cache backends
doctrine/collections                 v1.3.0             Collections Abstraction library
doctrine/common                      v2.6.1             Common Library for Doctrine projects
doctrine/data-fixtures               v1.1.1             Data Fixtures for all Doctrine Object Managers
doctrine/dbal                        v2.5.4             Database Abstraction Layer
doctrine/doctrine-bundle             1.6.2              Symfony DoctrineBundle
doctrine/doctrine-cache-bundle       1.3.0              Symfony Bundle for Doctrine Cache
doctrine/doctrine-fixtures-bundle    2.3.0              Symfony DoctrineFixturesBundle
doctrine/inflector                   v1.1.0             Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                1.0.5              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                       v1.0.1             Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                         v2.5.4             Object-Relational-Mapper for PHP
...
symfony/symfony                      v2.8.2             The Symfony PHP framework
... 

When using this config:

doctrine:
    dbal:
        server_version: 5.5

Everything works perfect:

$ php app/console cache:clear

 // Clearing the cache for the dev environment with debug true


 [OK] Cache for the "dev" environment (debug=true) was successfully cleared.



If I comment the server_version config:

doctrine:
    dbal:
        # server_version: 5.5

Nothing works anymore:

$ php app/console cache:clear -vvv

[2016-06-08 10:34:26] event.DEBUG: Notified event "console.command" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".
[2016-06-08 10:34:26] event.DEBUG: Notified event "console.command" to listener "Symfony\Bridge\Monolog\Handler\ConsoleHandler::onCommand".
[2016-06-08 10:34:26] event.DEBUG: Notified event "console.command" to listener "Symfony\Bridge\Monolog\Handler\ConsoleHandler::onCommand".

 // Clearing the cache for the dev environment with debug true
 // Clearing outdated warmup directory...
 // Warming up cache...


  [Doctrine\DBAL\Exception\ConnectionException]
  An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory


Exception trace:
 () at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:103
 Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:133
 Doctrine\DBAL\DBALException::driverException() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:47
 Doctrine\DBAL\Driver\PDOMySql\Driver->connect() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
 Doctrine\DBAL\Connection->connect() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429
 Doctrine\DBAL\Connection->getDatabasePlatformVersion() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389
 Doctrine\DBAL\Connection->detectDatabasePlatform() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328
 Doctrine\DBAL\Connection->getDatabasePlatform() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:763
 Doctrine\ORM\Mapping\ClassMetadataFactory->getTargetPlatform() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:632
 Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:174
 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at <my_project>/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
 Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata() at <my_project>/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:281
 Doctrine\ORM\EntityManager->getClassMetadata() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php:44
 Doctrine\ORM\Repository\DefaultRepositoryFactory->getRepository() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:698
 Doctrine\ORM\EntityManager->getRepository() at <my_project>/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php:242
 Doctrine\Common\Persistence\AbstractManagerRegistry->getRepository() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:568
 ap_DevDebugProjectContainer->getApp_UserProviderService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:4210
 ap_DevDebugProjectContainer->getSecurity_Authentication_ManagerService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:2658
 ap_DevDebugProjectContainer->getSecurity_AuthorizationCheckerService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:3760
 ap_DevDebugProjectContainer->getTwigService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:794
 ap_DevDebugProjectContainer->getCacheWarmerService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/bootstrap.php.cache:2695
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at <my_project>/app/bootstrap.php.cache:2465
 Symfony\Component\HttpKernel\Kernel->boot() at <my_project>/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:134
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() at <my_project>/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:96
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:860
 Symfony\Component\Console\Application->doRunCommand() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:192
 Symfony\Component\Console\Application->doRun() at <my_project>/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:98
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:123
 Symfony\Component\Console\Application->run() at <my_project>/app/console:27


  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[HY000] [2002] No such file or directory


Exception trace:
 () at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:47
 Doctrine\DBAL\Driver\PDOConnection::__construct() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:45
 Doctrine\DBAL\Driver\PDOMySql\Driver->connect() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
 Doctrine\DBAL\Connection->connect() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429
 Doctrine\DBAL\Connection->getDatabasePlatformVersion() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389
 Doctrine\DBAL\Connection->detectDatabasePlatform() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328
 Doctrine\DBAL\Connection->getDatabasePlatform() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:763
 Doctrine\ORM\Mapping\ClassMetadataFactory->getTargetPlatform() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:632
 Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:174
 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at <my_project>/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
 Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata() at <my_project>/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:281
 Doctrine\ORM\EntityManager->getClassMetadata() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php:44
 Doctrine\ORM\Repository\DefaultRepositoryFactory->getRepository() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:698
 Doctrine\ORM\EntityManager->getRepository() at <my_project>/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php:242
 Doctrine\Common\Persistence\AbstractManagerRegistry->getRepository() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:568
 ap_DevDebugProjectContainer->getApp_UserProviderService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:4210
 ap_DevDebugProjectContainer->getSecurity_Authentication_ManagerService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:2658
 ap_DevDebugProjectContainer->getSecurity_AuthorizationCheckerService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:3760
 ap_DevDebugProjectContainer->getTwigService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:794
 ap_DevDebugProjectContainer->getCacheWarmerService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/bootstrap.php.cache:2695
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at <my_project>/app/bootstrap.php.cache:2465
 Symfony\Component\HttpKernel\Kernel->boot() at <my_project>/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:134
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() at <my_project>/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:96
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:860
 Symfony\Component\Console\Application->doRunCommand() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:192
 Symfony\Component\Console\Application->doRun() at <my_project>/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:98
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:123
 Symfony\Component\Console\Application->run() at <my_project>/app/console:27


  [PDOException]
  SQLSTATE[HY000] [2002] No such file or directory


Exception trace:
 () at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
 PDO->__construct() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
 Doctrine\DBAL\Driver\PDOConnection->__construct() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:45
 Doctrine\DBAL\Driver\PDOMySql\Driver->connect() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
 Doctrine\DBAL\Connection->connect() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429
 Doctrine\DBAL\Connection->getDatabasePlatformVersion() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389
 Doctrine\DBAL\Connection->detectDatabasePlatform() at <my_project>/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328
 Doctrine\DBAL\Connection->getDatabasePlatform() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:763
 Doctrine\ORM\Mapping\ClassMetadataFactory->getTargetPlatform() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:632
 Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:174
 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at <my_project>/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
 Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata() at <my_project>/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:281
 Doctrine\ORM\EntityManager->getClassMetadata() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php:44
 Doctrine\ORM\Repository\DefaultRepositoryFactory->getRepository() at <my_project>/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:698
 Doctrine\ORM\EntityManager->getRepository() at <my_project>/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php:242
 Doctrine\Common\Persistence\AbstractManagerRegistry->getRepository() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:568
 ap_DevDebugProjectContainer->getApp_UserProviderService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:4210
 ap_DevDebugProjectContainer->getSecurity_Authentication_ManagerService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:2658
 ap_DevDebugProjectContainer->getSecurity_AuthorizationCheckerService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:3760
 ap_DevDebugProjectContainer->getTwigService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/cache/de_/ap_DevDebugProjectContainer.php:794
 ap_DevDebugProjectContainer->getCacheWarmerService() at <my_project>/app/bootstrap.php.cache:2187
 Symfony\Component\DependencyInjection\Container->get() at <my_project>/app/bootstrap.php.cache:2695
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at <my_project>/app/bootstrap.php.cache:2465
 Symfony\Component\HttpKernel\Kernel->boot() at <my_project>/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:134
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() at <my_project>/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:96
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:860
 Symfony\Component\Console\Application->doRunCommand() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:192
 Symfony\Component\Console\Application->doRun() at <my_project>/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:98
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at <my_project>/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:123
 Symfony\Component\Console\Application->run() at <my_project>/app/console:27

cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--] <command>

You are probably going to tell me that it’s not Doctrine fault because: cache:clear -> cache warmup -> Twig -> Security -> user provider -> database connection.

However, please consider that:

  • Before DBAL 2.5 this code worked (the same cache warmup, Twig, security, user provider, etc.)
  • Adding/removing a DBAL config option makes the application work/fail.

Thanks!

This seems because you’re relying in the auto-detection of platform to be used. Configure the platform to be used as part of DoctrineBundle and live happy. =)