IcingaCommandArgument: add more data type support
This commit is contained in:
parent
8be79b3dd6
commit
7ca64e18a7
|
@ -10,6 +10,11 @@ class IcingaCommandArgument extends IcingaObject
|
|||
|
||||
protected $table = 'icinga_command_argument';
|
||||
|
||||
protected $booleans = array(
|
||||
'skip_key' => 'skip_key',
|
||||
'repeat_key' => 'repeat_key'
|
||||
);
|
||||
|
||||
protected $defaultProperties = array(
|
||||
'id' => null,
|
||||
'command_id' => null,
|
||||
|
@ -48,6 +53,18 @@ class IcingaCommandArgument extends IcingaObject
|
|||
case 'string':
|
||||
$data['value'] = c::renderString($this->argument_value);
|
||||
break;
|
||||
case 'json':
|
||||
if (is_object($this->argument_value)) {
|
||||
$data['value'] = c::renderDictionary($this->argument_value);
|
||||
} elseif (is_array($this->argument_value)) {
|
||||
$data['value'] = c::renderArray($this->argument_value);
|
||||
} else {
|
||||
die('Unhandled');
|
||||
}
|
||||
break;
|
||||
case 'expression':
|
||||
$data['value'] = c::renderExpression($this->argument_value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,6 +72,18 @@ class IcingaCommandArgument extends IcingaObject
|
|||
$data['order'] = $this->sort_order;
|
||||
}
|
||||
|
||||
if ($this->set_if) {
|
||||
$data['set_if'] = c::renderString($this->set_if);
|
||||
}
|
||||
|
||||
if ((int) $this->sort_order !== 0) {
|
||||
$data['order'] = $this->sort_order;
|
||||
}
|
||||
|
||||
if ($this->description) {
|
||||
$data['description'] = c::renderString($this->description);
|
||||
}
|
||||
|
||||
return c::renderDictionary($data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue