From 0b052bb05a54f1032444b8ce9af8d543f31d88e4 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 3 Dec 2015 01:37:10 +0100 Subject: [PATCH] ImportSource: add failsafe getSetting() method --- library/Director/Objects/ImportSource.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/Director/Objects/ImportSource.php b/library/Director/Objects/ImportSource.php index bd26e905..985a02b1 100644 --- a/library/Director/Objects/ImportSource.php +++ b/library/Director/Objects/ImportSource.php @@ -52,6 +52,15 @@ class ImportSource extends DbObject return $this->settings; } + public function getSetting($name, $default = null) + { + if (array_key_exists($name, $this->settings)) { + return $this->settings[$name]; + } + + return $default; + } + protected function onStore() { $old = $this->fetchSettingsFromDb();