Skip to content

Commit 10e7a0a

Browse files
committed
Merge branch 'main' of github.com:utopia-php/database into null-permissions
2 parents 360a6e9 + 1e15e24 commit 10e7a0a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Database/Document.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,24 @@ public function __construct(array $input = [])
3535
throw new StructureException('$permissions must be of type array');
3636
}
3737

38-
foreach ($input as $key => &$value) {
38+
foreach ($input as $key => $value) {
3939
if (!\is_array($value)) {
4040
continue;
4141
}
42-
if ((isset($value['$id']) || isset($value['$collection']))) {
42+
43+
if (isset($value['$id']) || isset($value['$collection'])) {
4344
$input[$key] = new self($value);
4445
continue;
4546
}
47+
4648
foreach ($value as $childKey => $child) {
4749
if ((isset($child['$id']) || isset($child['$collection'])) && (!$child instanceof self)) {
4850
$value[$childKey] = new self($child);
4951
}
5052
}
51-
}
5253

53-
unset($value); // Unset Reference
54+
$input[$key] = $value;
55+
}
5456

5557
parent::__construct($input);
5658
}

0 commit comments

Comments
 (0)