public function FlagService::unflagAllByFlag in Flag 8.4
Remove all flaggings from a flag.
Parameters
\Drupal\Flag\FlagInterface $flag: The flag object.
Overrides FlagServiceInterface::unflagAllByFlag
File
- src/
FlagService.php, line 302
Class
- FlagService
- Flag service.
Namespace
Drupal\flagCode
public function unflagAllByFlag(FlagInterface $flag) {
$query = $this->entityTypeManager
->getStorage('flagging')
->getQuery();
$query
->condition('flag_id', $flag
->id());
$ids = $query
->execute();
$flaggings = $this
->getFlaggingsByIds($ids);
$this->entityTypeManager
->getStorage('flagging')
->delete($flaggings);
}