mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-26 23:34:10 +02:00
IcingaObjectImports: gracefully ignore empty members
This commit is contained in:
parent
7498820700
commit
f3e526f95f
@ -147,9 +147,16 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
|
|||||||
|
|
||||||
public function add($import)
|
public function add($import)
|
||||||
{
|
{
|
||||||
|
$class = $this->getImportClass();
|
||||||
|
|
||||||
// TODO: only one query when adding array
|
// TODO: only one query when adding array
|
||||||
if (is_array($import)) {
|
if (is_array($import)) {
|
||||||
foreach ($import as $i) {
|
foreach ($import as $i) {
|
||||||
|
// Gracefully ignore null members or empty strings
|
||||||
|
if (! $i instanceof $class && strlen($i) === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->add($i);
|
$this->add($i);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
@ -159,7 +166,6 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = $this->getImportClass();
|
|
||||||
$connection = $this->object->getConnection();
|
$connection = $this->object->getConnection();
|
||||||
|
|
||||||
if ($import instanceof $class) {
|
if ($import instanceof $class) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user