@@ -266,16 +266,12 @@ public function countSharesForTables(array $tableIds, ?string $userId = null): a
266266 $ excluded = !$ this ->circleHelper ->isCirclesEnabled () ? [ShareReceiverType::CIRCLE ] : [];
267267 $ shares = $ this ->mapper ->findAllSharesForNodes ('table ' , $ tableIds , $ userId , $ excluded );
268268
269- $ counts = [] ;
269+ $ counts = array_fill_keys ( $ tableIds , 0 ) ;
270270 foreach ($ shares as $ share ) {
271271 $ nodeId = $ share ->getNodeId ();
272272 $ counts [$ nodeId ] = ($ counts [$ nodeId ] ?? 0 ) + 1 ;
273273 }
274274
275- foreach ($ tableIds as $ tableId ) {
276- $ counts [$ tableId ] ??= 0 ;
277- }
278-
279275 return $ counts ;
280276 } catch (Exception $ e ) {
281277 $ this ->logger ->error ($ e ->getMessage ());
@@ -296,16 +292,12 @@ public function countSharesForViews(array $viewIds, ?string $userId = null): arr
296292 $ excluded = !$ this ->circleHelper ->isCirclesEnabled () ? [ShareReceiverType::CIRCLE ] : [];
297293 $ shares = $ this ->mapper ->findAllSharesForNodes ('view ' , $ viewIds , $ userId , $ excluded );
298294
299- $ counts = [] ;
295+ $ counts = array_fill_keys ( $ viewIds , 0 ) ;
300296 foreach ($ shares as $ share ) {
301297 $ nodeId = $ share ->getNodeId ();
302298 $ counts [$ nodeId ] = ($ counts [$ nodeId ] ?? 0 ) + 1 ;
303299 }
304300
305- foreach ($ viewIds as $ viewId ) {
306- $ counts [$ viewId ] ??= 0 ;
307- }
308-
309301 return $ counts ;
310302 } catch (Exception $ e ) {
311303 $ this ->logger ->error ($ e ->getMessage ());
0 commit comments