mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaObject: support merge for objects with no CV
This commit is contained in:
parent
b6dc8e5faf
commit
8b903486d3
@ -1301,12 +1301,19 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
public function merge(IcingaObject $object)
|
public function merge(IcingaObject $object)
|
||||||
{
|
{
|
||||||
$object = clone($object);
|
$object = clone($object);
|
||||||
$vars = $object->getVars();
|
|
||||||
$object->vars = array();
|
if ($object->supportsCustomVars()) {
|
||||||
|
$vars = $object->getVars();
|
||||||
|
$object->vars = array();
|
||||||
|
}
|
||||||
|
|
||||||
$this->setProperties((array) $object->toPlainObject(null, true));
|
$this->setProperties((array) $object->toPlainObject(null, true));
|
||||||
$myVars = $this->vars();
|
|
||||||
foreach ($vars as $key => $var) {
|
if ($object->supportsCustomVars()) {
|
||||||
$myVars->set($key, $var);
|
$myVars = $this->vars();
|
||||||
|
foreach ($vars as $key => $var) {
|
||||||
|
$myVars->set($key, $var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user