File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1534,7 +1534,7 @@ public function createOrUpdateDocuments(
15341534
15351535 // Calculate removals
15361536 foreach (Database::PERMISSIONS as $ type ) {
1537- $ toRemove = \array_diff ($ currentPermissions [$ type ], $ document ->getPermissionsByType ($ type ));
1537+ $ toRemove = \array_diff ($ currentPermissions [$ type ] ?? [] , $ document ->getPermissionsByType ($ type ));
15381538 if (!empty ($ toRemove )) {
15391539 $ removeQueries [] = "(
15401540 _document = :_uid_ {$ index }
@@ -1552,16 +1552,19 @@ public function createOrUpdateDocuments(
15521552
15531553 // Calculate additions
15541554 foreach (Database::PERMISSIONS as $ type ) {
1555- $ toAdd = \array_diff ($ document ->getPermissionsByType ($ type ), $ currentPermissions [$ type ]);
1555+ $ toAdd = \array_diff ($ document ->getPermissionsByType ($ type ), $ currentPermissions [$ type ] ?? [] );
15561556 foreach ($ toAdd as $ i => $ permission ) {
15571557 $ addQuery = "(:_uid_ {$ index }, ' {$ type }', :add_ {$ type }_ {$ index }_ {$ i }" ;
1558+
15581559 if ($ this ->sharedTables ) {
15591560 $ addQuery .= ", :_tenant_ {$ index }" ;
15601561 }
1562+
15611563 $ addQuery .= ") " ;
15621564 $ addQueries [] = $ addQuery ;
15631565 $ addBindValues [":_uid_ {$ index }" ] = $ document ->getId ();
15641566 $ addBindValues [":add_ {$ type }_ {$ index }_ {$ i }" ] = $ permission ;
1567+
15651568 if ($ this ->sharedTables ) {
15661569 $ addBindValues [":_tenant_ {$ index }" ] = $ document ->getTenant ();
15671570 }
You can’t perform that action at this time.
0 commit comments