diff --git a/src/SeriousJSON/JsonDatabase.php b/src/SeriousJSON/JsonDatabase.php index 0395ad1..13a1500 100644 --- a/src/SeriousJSON/JsonDatabase.php +++ b/src/SeriousJSON/JsonDatabase.php @@ -202,7 +202,7 @@ class JsonDatabase implements IJsonUnflattener return []; $serIdentifier = self::SanitizeIdentifier(strval($serIdentifier)); - if (empty($serIdentifier) || empty($serClass)) + if (empty($serIdentifier) || empty($serClass) || empty($findClass)) return []; $serPath = $this->getObjectPath($serClass, $serIdentifier) . self::$EXTENSION_INDEX; @@ -220,8 +220,8 @@ class JsonDatabase implements IJsonUnflattener return []; // TODO: Check if the referenced objects exist on disk - if (array_key_exists(get_class($findClass), $indexJson)) - return $indexJson[get_class($findClass)]; + if (array_key_exists($findClass, $indexJson)) + return $indexJson[$findClass]; else return []; } @@ -245,7 +245,7 @@ class JsonDatabase implements IJsonUnflattener if (strlen($objPath) > PHP_MAXPATHLEN) throw new Exception('JsonDatabase: Specified Path ' . $objPath . ' is longer than allowed.'); - $objJson = $obj->Serialize(nested: $this->nested, to_array: false); + $objJson = $obj->Serialize(nested: $this->nested, to_array: false, callback: $this); if ($this->audit) {