mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
CompatObject: Add support for value transformation
This commit is contained in:
parent
dd1d5bb7a1
commit
522e6f35db
1 changed files with 17 additions and 6 deletions
|
|
@ -145,18 +145,29 @@ trait CompatObject
|
|||
}
|
||||
|
||||
if (isset($this->legacyColumns[$name])) {
|
||||
$name = $this->legacyColumns[$name];
|
||||
$opts = $this->legacyColumns[$name];
|
||||
if ($opts === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (is_array($name)) {
|
||||
$path = $opts['path'];
|
||||
$value = null;
|
||||
|
||||
if (! empty($path)) {
|
||||
$value = $this->object;
|
||||
|
||||
do {
|
||||
$col = array_shift($name);
|
||||
$col = array_shift($path);
|
||||
$value = $value->$col;
|
||||
} while (! empty($name));
|
||||
|
||||
return $value;
|
||||
} while (! empty($path));
|
||||
}
|
||||
|
||||
if (isset($opts['type'])) {
|
||||
$method = 'get' . ucfirst($opts['type']) . 'Type';
|
||||
$value = $this->$method($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $this->object->$name;
|
||||
|
|
|
|||
Loading…
Reference in a new issue