From 4fe6cc65095a6cdf085781676bb9b09f58c77d42 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Fri, 25 Mar 2016 12:44:42 +1100 Subject: [PATCH] Adds a clearInternalCache method to SettingsModels Fixes #1815 --- modules/system/behaviors/SettingsModel.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/system/behaviors/SettingsModel.php b/modules/system/behaviors/SettingsModel.php index ac66811fe..0603eec87 100644 --- a/modules/system/behaviors/SettingsModel.php +++ b/modules/system/behaviors/SettingsModel.php @@ -25,7 +25,10 @@ class SettingsModel extends ModelBehavior protected $fieldConfig; protected $fieldValues = []; - private static $instances = []; + /** + * @var array Internal cache of model objects. + */ + protected static $instances = []; /** * {@inheritDoc} @@ -249,4 +252,13 @@ class SettingsModel extends ModelBehavior { return 'system::settings.'.$this->recordCode; } + + /** + * Clears the internal memory cache of model instances. + * @return void + */ + public static function clearInternalCache() + { + static::$instances = []; + } }