From 047e9dd70d27f877cf06011c66844f7c98bc51a1 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 3 Jan 2017 11:16:00 +0100 Subject: [PATCH] LegacyStorage: throw error on incomplete imports --- .../Businessprocess/Storage/LegacyStorage.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/library/Businessprocess/Storage/LegacyStorage.php b/library/Businessprocess/Storage/LegacyStorage.php index 8d009cc..b914de4 100644 --- a/library/Businessprocess/Storage/LegacyStorage.php +++ b/library/Businessprocess/Storage/LegacyStorage.php @@ -463,10 +463,19 @@ class LegacyStorage extends Storage $bp->createService($host, $service); } } - if ($val[0] === '@' && strpos($val, ':') !== false) { - list($config, $nodeName) = preg_split('~:\s*~', substr($val, 1), 2); - $bp->createImportedNode($config, $nodeName); - $val = $nodeName; + if ($val[0] === '@') { + if (strpos($val, ':') === false) { + throw new ConfigurationError( + "I'm unable to import full external configs, a node needs to be provided for '%s'", + $val + ); + // TODO: this might work: + // $node = $bp->createImportedNode(substr($val, 1)); + } else { + list($config, $nodeName) = preg_split('~:\s*~', substr($val, 1), 2); + $node = $bp->createImportedNode($config, $nodeName); + } + $val = $node->getName(); } $childNames[] = $val;