Skip to content

Commit

Permalink
ENH Add ability to ignore missing fields
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala authored Mar 20, 2024
1 parent fb034a9 commit a5fb281
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Model/CachableModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a5fb281

Please sign in to comment.