From 49e24b726ddf2aa76fe8fce65816d066cca84e22 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 9 Aug 2020 18:03:28 +0300 Subject: [PATCH] Added decode/encode support in DB overwrite method --- src/Appwrite/Database/Database.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Database/Database.php b/src/Appwrite/Database/Database.php index 181a914c8b..d68bc07907 100644 --- a/src/Appwrite/Database/Database.php +++ b/src/Appwrite/Database/Database.php @@ -315,13 +315,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; } /**