From 48a8e1ab63bd39eb2273c26d20fbe72c68a30250 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 31 Jul 2015 14:33:09 +0200 Subject: [PATCH] IcingaObjectImports: simplify code --- library/Director/Objects/IcingaObjectImports.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/library/Director/Objects/IcingaObjectImports.php b/library/Director/Objects/IcingaObjectImports.php index b8ab2c72..470c1244 100644 --- a/library/Director/Objects/IcingaObjectImports.php +++ b/library/Director/Objects/IcingaObjectImports.php @@ -158,19 +158,9 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer if ($import instanceof $class) { $this->imports[$import->object_name] = $import; } elseif (is_string($import)) { - $query = $this->object->getDb()->select()->from( - $this->object->getTableName() - )->where('object_name = ?', $import); - $imports = $class::loadAll($connection, $query, 'object_name'); + $import = $class::load($import, $connection); + $this->imports[$import->object_name] = $import; } - if (! array_key_exists($import, $imports)) { - throw new ProgrammingError( - 'The import "%s" doesn\'t exists.', - $import - ); - } - - $this->imports[$import] = $imports[$import]; $this->modified = true; $this->refreshIndex();