Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Comment.php

function Comment::postDelete

Overrides EntityBase::postDelete

File

core/modules/comment/src/Entity/Comment.php, line 198

Class

Comment
Defines the comment entity class.

Namespace

Drupal\comment\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $entities) {
    parent::postDelete($storage, $entities);
    $child_cids = $storage->getChildCids($entities);
    $comment_storage = \Drupal::entityTypeManager()->getStorage('comment');
    $comments = $comment_storage->loadMultiple($child_cids);
    $comment_storage->delete($comments);
    foreach ($entities as $entity) {
        \Drupal::service('comment.statistics')->update($entity);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal