mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
BasketSnapshotFieldResolver: provide fixOptional...
...DatalistReference()
This commit is contained in:
parent
02d6ebb0af
commit
479d964841
@ -4,8 +4,10 @@ namespace Icinga\Module\Director\DirectorObject\Automation;
|
|||||||
|
|
||||||
use Icinga\Module\Director\Db;
|
use Icinga\Module\Director\Db;
|
||||||
use Icinga\Module\Director\Objects\DirectorDatafield;
|
use Icinga\Module\Director\Objects\DirectorDatafield;
|
||||||
|
use Icinga\Module\Director\Objects\DirectorDatalist;
|
||||||
use Icinga\Module\Director\Objects\IcingaObject;
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
class BasketSnapshotFieldResolver
|
class BasketSnapshotFieldResolver
|
||||||
{
|
{
|
||||||
@ -141,6 +143,22 @@ class BasketSnapshotFieldResolver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function fixOptionalDatalistReference(stdClass $plain, Db $db)
|
||||||
|
{
|
||||||
|
if (isset($plain->settings->datalist_uuid)) {
|
||||||
|
unset($plain->settings->datalist);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isset($plain->settings->datalist)) {
|
||||||
|
// Just try to load the list, final import will fail if missing
|
||||||
|
// No modification in case we do not find the list,
|
||||||
|
if ($list = DirectorDatalist::loadOptional($plain->settings->datalist, $db)) {
|
||||||
|
unset($plain->settings->datalist);
|
||||||
|
$plain->settings->datalist_id = $list->get('id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function getNextNewId(): int
|
protected function getNextNewId(): int
|
||||||
{
|
{
|
||||||
return $this->nextNewId++;
|
return $this->nextNewId++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user