From a5fb2816201d7ed379ccfc33f159e9debfa915b6 Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Wed, 20 Mar 2024 12:29:25 +0100 Subject: [PATCH] ENH Add ability to ignore missing fields --- src/Model/CachableModel.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Model/CachableModel.php b/src/Model/CachableModel.php index c90c61f1..078e909e 100644 --- a/src/Model/CachableModel.php +++ b/src/Model/CachableModel.php @@ -9,6 +9,7 @@ use SilverStripe\ORM\Connect\DatabaseException; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; +use SilverStripe\Core\Environment; /** * Allows you to cache a full list of objects without multiple DB queries @@ -76,6 +77,11 @@ protected static function databaseIsReady() return false; } + // For performance reason, we may want to return early and not make a SHOW FULL FIELDS query + if (Environment::getEnv('SS_FLUENT_IGNORE_MISSING_FIELDS')) { + return true; + } + // if any of the tables don't have all fields mapped as table columns $dbFields = DB::field_list($table); if (!$dbFields) {