IcingaCommandArgumentForm: store command, not args

refs #11536
This commit is contained in:
Thomas Gelf 2016-08-01 10:45:47 +00:00
parent 6258230fdb
commit 52e412002f
2 changed files with 11 additions and 4 deletions

View File

@ -116,7 +116,7 @@ class IcingaCommandArgumentForm extends DirectorObjectForm
$this->translate('The argument %s has successfully been stored'),
$object->argument_name
);
$object->store($this->db);
$cmd->store($this->db);
} else {
$this->setHttpResponseCode(304);
$msg = $this->translate('No action taken, object has not been modified');

View File

@ -82,9 +82,16 @@ class IcingaArguments implements Iterator, Countable, IcingaConfigRenderer
public function set($key, $value)
{
$argument = IcingaCommandArgument::create(
$this->mungeCommandArgument($key, $value)
)->set('command_id', $this->object->id);
if ($value instanceof IcingaCommandArgument) {
$argument = $value;
} else {
$argument = IcingaCommandArgument::create(
$this->mungeCommandArgument($key, $value)
);
}
$argument->set('command_id', $this->object->id);
$key = $argument->argument_name;
if (array_key_exists($key, $this->arguments)) {
$this->arguments[$key]->replaceWith($argument);