Skip to content

Commit 360a6e9

Browse files
committed
Address comments
1 parent a41d4ad commit 360a6e9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/Database/Database.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6304,7 +6304,7 @@ public function encode(Document $collection, Document $document): Document
63046304
$value = $document->getAttribute($key);
63056305

63066306
if ($key === '$permissions') {
6307-
if (empty($value)){
6307+
if (empty($value)) {
63086308
$document->setAttribute('$permissions', []); // set default value
63096309
}
63106310
continue;
@@ -6366,7 +6366,10 @@ public function decode(Document $collection, Document $document, array $selectio
63666366
foreach ($relationships as $relationship) {
63676367
$key = $relationship['$id'] ?? '';
63686368

6369-
if ($document->offsetExists($key) || $document->offsetExists($this->adapter->filter($key))) {
6369+
if (
6370+
\array_key_exists($key, (array)$document)
6371+
|| \array_key_exists($this->adapter->filter($key), (array)$document)
6372+
) {
63706373
$value = $document->getAttribute($key);
63716374
$value ??= $document->getAttribute($this->adapter->filter($key));
63726375
$document->removeAttribute($this->adapter->filter($key));

0 commit comments

Comments
 (0)