From a56ca3535ae4ebb62c9ce0e633b45fd7de501a50 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 29 Oct 2020 13:32:39 +0200 Subject: [PATCH] Updated document missing encode/decode action --- src/Appwrite/Database/Database.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Database/Database.php b/src/Appwrite/Database/Database.php index 70725a89d..51b46d265 100644 --- a/src/Appwrite/Database/Database.php +++ b/src/Appwrite/Database/Database.php @@ -158,7 +158,7 @@ class Database $results = $this->adapter->getCollection($options); foreach ($results as &$node) { - $node = new Document($node); + $node = $this->decode(new Document($node)); } return $results; @@ -317,13 +317,19 @@ class Database throw new AuthorizationException($validator->getDescription()); // var_dump($validator->getDescription()); return false; } + $new = $this->encode($new); + $validator = new Structure($this); if (!$validator->isValid($new)) { // Make sure updated structure still apply collection rules (if any) throw new StructureException($validator->getDescription()); // var_dump($validator->getDescription()); return false; } - return new Document($this->adapter->updateDocument($data)); + $new = new Document($this->adapter->updateDocument($new->getArrayCopy())); + + $new = $this->decode($new); + + return $new; } /**