Closed
Description
Symfony version(s) affected
7.0
Description
When using a MySQL based DB, if the database table doesn't exist when calling Connection::get - it will result in an exception even when auto setup is enabled.
How to reproduce
Call Connection::get on a MySQL based DB when autosetup is enabled and the database table doesn't yet exist
Possible Solution
Catch a TableNotFoundException inside the if statement at the top of ::get
catch (TableNotFoundException) {
if ($this->autoSetup) {
$this->setup();
}
}
Additional Context
This bug was found when implementing a Symfony Messenger based app on a Drupal site using https://www.drupal.org/project/sm - when attempting to consume messages before a message had been created (and therefore the table didn't exist) an exception was thrown.