@@ -3615,6 +3615,10 @@ public function createDocument(string $collection, Document $document): Document
36153615 ->setAttribute ('$createdAt ' , ($ createdAt === null || !$ this ->preserveDates ) ? $ time : $ createdAt )
36163616 ->setAttribute ('$updatedAt ' , ($ updatedAt === null || !$ this ->preserveDates ) ? $ time : $ updatedAt );
36173617
3618+ if (empty ($ document ->getPermissions ())) {
3619+ $ document ->setAttribute ('$permissions ' , []);
3620+ }
3621+
36183622 if ($ this ->adapter ->getSharedTables ()) {
36193623 if ($ this ->adapter ->getTenantPerDocument ()) {
36203624 if (
@@ -3715,6 +3719,10 @@ public function createDocuments(
37153719 ->setAttribute ('$createdAt ' , ($ createdAt === null || !$ this ->preserveDates ) ? $ time : $ createdAt )
37163720 ->setAttribute ('$updatedAt ' , ($ updatedAt === null || !$ this ->preserveDates ) ? $ time : $ updatedAt );
37173721
3722+ if (empty ($ document ->getPermissions ())) {
3723+ $ document ->setAttribute ('$permissions ' , []);
3724+ }
3725+
37183726 if ($ this ->adapter ->getSharedTables ()) {
37193727 if ($ this ->adapter ->getTenantPerDocument ()) {
37203728 if ($ document ->getTenant () === null ) {
@@ -4456,6 +4464,7 @@ public function updateDocuments(
44564464
44574465 $ document = $ this ->encode ($ collection , $ document );
44584466 }
4467+
44594468 $ this ->adapter ->updateDocuments (
44604469 $ collection ->getId (),
44614470 $ updates ,
@@ -6350,9 +6359,6 @@ public function encode(Document $collection, Document $document): Document
63506359 }
63516360
63526361 if ($ key === '$permissions ' ) {
6353- if (empty ($ value )) {
6354- $ document ->setAttribute ('$permissions ' , []); // set default value
6355- }
63566362 continue ;
63576363 }
63586364
@@ -6433,6 +6439,10 @@ public function decode(Document $collection, Document $document, array $selectio
64336439 $ filters = $ attribute ['filters ' ] ?? [];
64346440 $ value = $ document ->getAttribute ($ key );
64356441
6442+ if ($ key === '$permissions ' ) {
6443+ continue ;
6444+ }
6445+
64366446 if (\is_null ($ value )) {
64376447 $ value = $ document ->getAttribute ($ this ->adapter ->filter ($ key ));
64386448
@@ -6492,6 +6502,10 @@ public function casting(Document $collection, Document $document): Document
64926502 continue ;
64936503 }
64946504
6505+ if ($ key === '$permissions ' ) {
6506+ continue ;
6507+ }
6508+
64956509 if ($ array ) {
64966510 $ value = !is_string ($ value )
64976511 ? $ value
0 commit comments