From 8f266da543653ae635987a26103dbbe603834e16 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 17 Jun 2019 16:03:01 +0200 Subject: [PATCH] #2840 --- src/app/Magic/Fields/Model.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/Magic/Fields/Model.php b/src/app/Magic/Fields/Model.php index 0bba065..7f4bf52 100644 --- a/src/app/Magic/Fields/Model.php +++ b/src/app/Magic/Fields/Model.php @@ -6,7 +6,7 @@ namespace Cubist\Backpack\app\Magic\Fields; class Model extends Field { - protected static $_options = null; + protected static $_options = []; public function getColumnData() { @@ -23,10 +23,12 @@ class Model extends Field protected function _getOptions() { - if (null === static::$_options) { - static::$_options = $this->__getOptions(); + $cacheKey = $this->getAttribute('name') . '-' . $this->getAttribute('optionsmodel'); + + if (!isset(static::$_options[$cacheKey])) { + static::$_options[$cacheKey] = $this->__getOptions(); } - return static::$_options; + return static::$_options[$cacheKey]; } protected function __getOptions() -- 2.39.5