@@ -6303,7 +6303,7 @@ public function encode(Document $collection, Document $document): Document
63036303 $ filters = $ attribute ['filters ' ] ?? [];
63046304 $ value = $ document ->getAttribute ($ key );
63056305
6306- if ($ attribute [ ' $id ' ] === '$permissions ' ) {
6306+ if ($ key === '$permissions ' ) {
63076307 if (empty ($ value )){
63086308 $ document ->setAttribute ('$permissions ' , []); // set default value
63096309 }
@@ -6379,9 +6379,6 @@ public function decode(Document $collection, Document $document, array $selectio
63796379 }
63806380
63816381 foreach ($ attributes as $ attribute ) {
6382- // if ($attribute['$id'] === '$permissions') {
6383- // continue;
6384- // }
63856382 $ key = $ attribute ['$id ' ] ?? '' ;
63866383 $ array = $ attribute ['array ' ] ?? false ;
63876384 $ filters = $ attribute ['filters ' ] ?? [];
@@ -6398,11 +6395,11 @@ public function decode(Document $collection, Document $document, array $selectio
63986395 $ value = ($ array ) ? $ value : [$ value ];
63996396 $ value = (is_null ($ value )) ? [] : $ value ;
64006397
6401- foreach ($ value as $ k => $ node ) {
6398+ foreach ($ value as $ index => $ node ) {
64026399 foreach (array_reverse ($ filters ) as $ filter ) {
64036400 $ node = $ this ->decodeAttribute ($ filter , $ node , $ document , $ key );
64046401 }
6405- $ value [$ k ] = $ node ;
6402+ $ value [$ index ] = $ node ;
64066403 }
64076404
64086405 if (
@@ -6438,9 +6435,6 @@ public function casting(Document $collection, Document $document): Document
64386435 }
64396436
64406437 foreach ($ attributes as $ attribute ) {
6441- // if ($attribute['$id'] === '$permissions') {
6442- // continue;
6443- // }
64446438 $ key = $ attribute ['$id ' ] ?? '' ;
64456439 $ type = $ attribute ['type ' ] ?? '' ;
64466440 $ array = $ attribute ['array ' ] ?? false ;
@@ -6457,7 +6451,7 @@ public function casting(Document $collection, Document $document): Document
64576451 $ value = [$ value ];
64586452 }
64596453
6460- foreach ($ value as $ k => $ node ) {
6454+ foreach ($ value as $ index => $ node ) {
64616455 switch ($ type ) {
64626456 case self ::VAR_BOOLEAN :
64636457 $ node = (bool )$ node ;
@@ -6472,7 +6466,7 @@ public function casting(Document $collection, Document $document): Document
64726466 break ;
64736467 }
64746468
6475- $ value [$ k ] = $ node ;
6469+ $ value [$ index ] = $ node ;
64766470 }
64776471
64786472 $ document ->setAttribute ($ key , ($ array ) ? $ value : $ value [0 ]);
0 commit comments