Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Doctrine DBAL 2.5 Breaks Symfony if DB Doesn't Exist #351

Copy link
Copy link
Closed
doctrine/dbal
#2671
doctrine/dbal#2671
@mattjanssen

Description

@mattjanssen
Issue body actions

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'

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.