Change record status: 
Project: 
Introduced in branch: 
8.x-4.x
Description: 

OBSOLETE: see https://www.drupal.org/node/2476349

A collection of global scope functions used to count of flags have been moved from the file flag.module into a dedicated service 'flag.count'

[ Details can be found in the FlagCountManagerInterface ]

While injecting the service directly is prefered, for procedural code the new service can be obtained by

$flagCountService = \Drupal::service('flag.count');

Here the affected functions are listed with their replacements.

flag_get_entity_flag_counts($this->flag, 'node');
$flagCountService->getEntityCounts($this->flag, 'node');
flag_get_user_flag_counts($this->flag, $this->adminUser);
$flagCountService->getUserCounts($this->flag, $this->adminUser);
flag_get_counts('node', $this->node->id());
$flagCountService->getCounts('node', $this->node->id());
flag_get_flag_counts($this->id);
$flagCountService->getTotals($this->id);
Impacts: 
Module developers