mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 16:54:06 +02:00
IcingaObject: fix key handling for unresolved props
This commit is contained in:
parent
b3a44bd7dd
commit
f2d9e1a544
@ -186,13 +186,14 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
|
|
||||||
protected function resolveUnresolvedRelatedProperty($name)
|
protected function resolveUnresolvedRelatedProperty($name)
|
||||||
{
|
{
|
||||||
$class = $this->getRelationClass($name);
|
$short = substr($name, 0, -3);
|
||||||
|
$class = $this->getRelationClass($short);
|
||||||
$object = $class::load(
|
$object = $class::load(
|
||||||
$this->unresolvedRelatedProperties[$name],
|
$this->unresolvedRelatedProperties[$name],
|
||||||
$this->connection
|
$this->connection
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->$key = $object->id;
|
$this->$name = $object->id;
|
||||||
unset($this->unresolvedRelatedProperties[$name]);
|
unset($this->unresolvedRelatedProperties[$name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,8 +236,8 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
if (substr($key, -3) === '_id') {
|
if (substr($key, -3) === '_id') {
|
||||||
$short = substr($key, 0, -3);
|
$short = substr($key, 0, -3);
|
||||||
if ($this->hasRelation($short)) {
|
if ($this->hasRelation($short)) {
|
||||||
if (array_key_exists($short, $this->unresolvedRelatedProperties)) {
|
if (array_key_exists($key, $this->unresolvedRelatedProperties)) {
|
||||||
$this->resolveUnresolvedRelatedProperty($short);
|
$this->resolveUnresolvedRelatedProperty($key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user