FieldLoader: do not fail missing fields

One might have toggled template or command, sent values for missing fields
might therefore be perfectly legal and should be silently ignored

refs #13241
This commit is contained in:
Thomas Gelf 2016-12-13 16:57:32 +01:00
parent e60fdb31b8
commit 2cfa78af14
1 changed files with 11 additions and 5 deletions

View File

@ -92,15 +92,21 @@ class IcingaObjectFieldLoader
$varName = $this->getElementVarName($prefix . $key);
if ($varName === null) {
throw new IcingaException(
'Cannot set variable value for "%s", got no such element',
$key
);
// throw new IcingaException(
// 'Cannot set variable value for "%s", got no such element',
// $key
// );
// Silently ignore additional fields. One might have switched
// template or command
continue;
}
$el = $this->getElement($varName);
if ($el === null) {
throw new IcingaException('No such element %s', $key);
// throw new IcingaException('No such element %s', $key);
// Same here.
continue;
}
$el->setValue($value);