From 39acf18bc329e4e6e9c0e40d05ee17907d4c75d6 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 30 Mar 2023 20:54:45 +1300 Subject: [PATCH] Handle document arrays when filtering documents --- src/Appwrite/Utopia/Response/Model/Document.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Response/Model/Document.php b/src/Appwrite/Utopia/Response/Model/Document.php index ea21c89668..43676593eb 100644 --- a/src/Appwrite/Utopia/Response/Model/Document.php +++ b/src/Appwrite/Utopia/Response/Model/Document.php @@ -75,7 +75,13 @@ class Document extends Any $document->removeAttribute('$collection'); // $collection is the internal collection ID foreach ($document->getAttributes() as $attribute) { - if ($attribute instanceof DatabaseDocument) { + if (\is_array($attribute)) { + foreach ($attribute as $subAttribute) { + if ($subAttribute instanceof DatabaseDocument) { + $this->filter($subAttribute); + } + } + } elseif ($attribute instanceof DatabaseDocument) { $this->filter($attribute); } }