[icinga-checkins] icinga.org: icingaweb2-module-director/master: PropertyModifierHook: allow modifiers to deal...

git at icinga.org git at icinga.org
Tue Aug 30 10:48:34 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: a4813e80460f58c73c4a181d54e29daa06e47b57
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=a4813e80460f58c73c4a181d54e29daa06e47b57

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Aug 30 07:53:10 2016 +0000

PropertyModifierHook: allow modifiers to deal...

...with arrays

refs #12236

---

 library/Director/Hook/PropertyModifierHook.php |    5 +++++
 library/Director/Objects/ImportSource.php      |    2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/library/Director/Hook/PropertyModifierHook.php b/library/Director/Hook/PropertyModifierHook.php
index bd5f986..ed97c33 100644
--- a/library/Director/Hook/PropertyModifierHook.php
+++ b/library/Director/Hook/PropertyModifierHook.php
@@ -28,6 +28,11 @@ abstract class PropertyModifierHook
         return $class;
     }
 
+    public function hasArraySupport()
+    {
+        return false;
+    }
+
     public function setTargetProperty($property)
     {
         $this->targetProperty = $property;
diff --git a/library/Director/Objects/ImportSource.php b/library/Director/Objects/ImportSource.php
index e1bf868..385d710 100644
--- a/library/Director/Objects/ImportSource.php
+++ b/library/Director/Objects/ImportSource.php
@@ -102,7 +102,7 @@ class ImportSource extends DbObjectWithSettings
 
                 $target = $mod->getTargetProperty($key);
 
-                if (is_array($row->$key)) {
+                if (is_array($row->$key) && ! $mod->hasArraySupport()) {
                     $new = array();
                     foreach ($row->$key as $k => $v) {
                         $new[$k] = $mod->transform($v);



More information about the icinga-checkins mailing list