public static function Vote::postDelete in Voting API 8.3
Acts on deleted entities before the delete hook is invoked.
Used after the entities are deleted but before invoking the delete hook.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.
Overrides EntityBase::postDelete
File
- src/
Entity/ Vote.php, line 280
Class
- Vote
- Defines the Vote entity.
Namespace
Drupal\votingapi\EntityCode
public static function postDelete(EntityStorageInterface $storage, array $entities) {
parent::postDelete($storage, $entities);
// If a vote is deleted, the results needs to be updated.
foreach ($entities as $entity) {
\Drupal::service('plugin.manager.votingapi.resultfunction')
->recalculateResults($entity
->getVotedEntityType(), $entity
->getVotedEntityId(), $entity
->bundle());
}
}