528,12 → 528,12 |
public function getParent()/*: ?OIDplusObject*/ { |
if (!OIDplus::baseConfig()->getValue('OBJECT_CACHING', true)) { |
$res = OIDplus::db()->query("select parent from ###objects where id = ?", array($this->nodeId())); |
if (!$res->any()) return null; |
if ($res->any()) { |
$row = $res->fetch_array(); |
$parent = $row['parent']; |
$obj = OIDplusObject::parse($parent); |
if ($obj) return $obj; |
// TODO: Also implement one_up() like below |
} |
} else { |
self::buildObjectInformationCache(); |
if (isset(self::$object_info_cache[$this->nodeId()])) { |
541,6 → 541,7 |
$obj = OIDplusObject::parse($parent); |
if ($obj) return $obj; |
} |
} |
|
// If this OID does not exist, the SQL query "select parent from ..." does not work. So we try to find the next possible parent using one_up() |
$cur = $this->one_up(); |
553,7 → 554,7 |
$cur = $cur->one_up(); |
if (!$cur) return null; |
} while ($prev->nodeId() !== $cur->nodeId()); |
} |
|
return null; |
} |
|