mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 08:44:11 +02:00
ObjectImporter, BasketDiff: fallback for baskets...
...with UUID, and no matching entry. Will adjust UUIDs for matching objects
This commit is contained in:
parent
5a732170af
commit
045f4ec941
@ -120,8 +120,10 @@ class ObjectImporter
|
||||
*/
|
||||
protected function loadExistingObject(string $implementation, stdClass $plain): ?DbObject
|
||||
{
|
||||
if (isset($plain->uuid)) {
|
||||
return $implementation::loadWithUniqueId(Uuid::fromString($plain->uuid), $this->db);
|
||||
if (isset($plain->uuid)
|
||||
&& $instance = $implementation::loadWithUniqueId(Uuid::fromString($plain->uuid), $this->db)
|
||||
) {
|
||||
return $instance;
|
||||
}
|
||||
|
||||
if ($implementation === IcingaService::class) {
|
||||
|
@ -97,8 +97,8 @@ class BasketDiff
|
||||
|
||||
public function getCurrentInstance(string $type, string $key, ?UuidInterface $uuid = null)
|
||||
{
|
||||
if ($uuid) {
|
||||
return BasketSnapshot::instanceByUuid($type, $uuid, $this->db);
|
||||
if ($uuid && $instance = BasketSnapshot::instanceByUuid($type, $uuid, $this->db)) {
|
||||
return $instance;
|
||||
} else {
|
||||
return BasketSnapshot::instanceByIdentifier($type, $key, $this->db);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user