From 0872ea17aa5c2c00ac9674b418875d0dc4b4c631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pavl=C3=AD=C4=8Dek?= Date: Sun, 14 Jan 2024 09:16:58 +0100 Subject: [PATCH] Added forcing of DB version for generate proxies to avoid connection to database --- lib/Common/EntityManagerFactory.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Common/EntityManagerFactory.php b/lib/Common/EntityManagerFactory.php index f876c9d..f95d7da 100755 --- a/lib/Common/EntityManagerFactory.php +++ b/lib/Common/EntityManagerFactory.php @@ -22,6 +22,13 @@ class EntityManagerFactory { self::checkRequiredParams($params, ['paths', 'database', 'proxy_dir']); + // workaround for doctrine console commands requiring active database connection - + // specifying server version explicitly doesn't trigger this connection, which is not + // needed for proxy generation + if (defined('STDIN') && @$_SERVER['argv'][1] == 'orm:generate-proxies') { + $params['database']['serverVersion'] = 14; + } + $paths = $params['paths']; $connection = $params['database'];