From 3e8de106d9c82b6ed2ac42c488b9cce7704ce2aa Mon Sep 17 00:00:00 2001 From: Micheal Date: Fri, 11 Sep 2020 09:14:31 +0200 Subject: [PATCH] Avoid exception on clear cache (database not exist) --- Core/H5POptions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Core/H5POptions.php b/Core/H5POptions.php index 42a2c0f..d537912 100644 --- a/Core/H5POptions.php +++ b/Core/H5POptions.php @@ -6,6 +6,8 @@ use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManagerInterface; use Studit\H5PBundle\Entity\Option; +use Doctrine\DBAL\Exception\ConnectionException; +use Doctrine\DBAL\Exception\TableNotFoundException; class H5POptions { @@ -41,7 +43,10 @@ public function __construct(?array $config, $projectRootDir, EntityManagerInterf public function getOption($name, $default = null) { - $this->retrieveStoredConfig(); + try { + $this->retrieveStoredConfig(); + } catch (ConnectionException | TableNotFoundException $e) { + } if (isset($this->storedConfig[$name])) { return $this->storedConfig[$name];