BranchedObject: set id first
This has an impact on related objects, like timeperiod ranges fixes #2525
This commit is contained in:
parent
ad5dfc8496
commit
e42912d3e8
|
@ -11,6 +11,9 @@ v1.10.2 (unreleased)
|
|||
* You can find issues and feature requests related to this release on our
|
||||
[roadmap](https://github.com/Icinga/icingaweb2-module-director/milestone/31?closed=1)
|
||||
|
||||
### UI
|
||||
* FIX: modifying single timeperiod ranges had no effect (#2525)
|
||||
|
||||
### Import and Sync
|
||||
* FIX: triggering Sync manually produced an error on PostgreSQL (#2636)
|
||||
|
||||
|
|
|
@ -267,14 +267,14 @@ class BranchedObject
|
|||
if ($this->object->hasProperty('object_type')) {
|
||||
$branched->set('object_type', $this->object->get('object_type'));
|
||||
}
|
||||
$branched->set('id', $this->object->get('id'));
|
||||
$branched->set('uuid', $this->object->get('uuid'));
|
||||
foreach ((array) $this->object->toPlainObject(false, true) as $key => $value) {
|
||||
if ($key === 'object_type') {
|
||||
continue;
|
||||
}
|
||||
$branched->set($key, $value);
|
||||
}
|
||||
$branched->set('id', $this->object->get('id'));
|
||||
$branched->set('uuid', $this->object->get('uuid'));
|
||||
} else {
|
||||
$branched = DbObjectTypeRegistry::newObject($this->objectTable, [], $connection);
|
||||
$branched->setUniqueId($this->objectUuid);
|
||||
|
|
|
@ -141,7 +141,7 @@ abstract class IcingaRanges
|
|||
} else {
|
||||
$class = $this->getRangeClass();
|
||||
$this->ranges[$range] = $class::create([
|
||||
$this->objectIdColumn => $this->object->id,
|
||||
$this->objectIdColumn => $this->object->get('id'),
|
||||
'range_key' => $range,
|
||||
'range_value' => $value,
|
||||
]);
|
||||
|
|
Loading…
Reference in New Issue