Closed
doctrine/dbal
#2671Description
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'