[icinga-checkins] icinga.org: icingaweb2-module-director/feature/icinga1-config-12919: IcingaObjectMultiRelations(Legacy): add toLegacyConfigString

git at icinga.org git at icinga.org
Fri Oct 14 15:44:26 CEST 2016


Module: icingaweb2-module-director
Branch: feature/icinga1-config-12919
Commit: c5539f552fc14a8f2b34e157e7d592752d5f56a4
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=c5539f552fc14a8f2b34e157e7d592752d5f56a4

Author: Markus Frosch <markus.frosch at icinga.com>
Date:   Fri Oct 14 15:42:29 2016 +0200

IcingaObjectMultiRelations(Legacy): add toLegacyConfigString

refs #12919

---

 library/Director/Objects/IcingaObjectMultiRelations.php |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/library/Director/Objects/IcingaObjectMultiRelations.php b/library/Director/Objects/IcingaObjectMultiRelations.php
index 5a5593a..bb3917c 100644
--- a/library/Director/Objects/IcingaObjectMultiRelations.php
+++ b/library/Director/Objects/IcingaObjectMultiRelations.php
@@ -8,6 +8,7 @@ use Iterator;
 use Countable;
 use Icinga\Module\Director\IcingaConfig\IcingaConfigRenderer;
 use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
+use Icinga\Module\Director\IcingaConfig\IcingaLegacyConfigHelper as c1;
 
 class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRenderer
 {
@@ -409,4 +410,15 @@ class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRen
             }
         }
     }
+
+    public function toLegacyConfigString()
+    {
+        $relations = array_keys($this->relations);
+
+        if (empty($relations)) {
+            return '';
+        }
+
+        return c1::renderKeyValue($this->propertyName, c1::renderArray($relations));
+    }
 }



More information about the icinga-checkins mailing list