protected function CommentStorageController::postDelete

Overrides Drupal\Core\Entity\DatabaseStorageController::postDelete().

Overrides DatabaseStorageController::postDelete

File

drupal/core/modules/comment/lib/Drupal/comment/CommentStorageController.php, line 175
Definition of Drupal\comment\CommentStorageController.

Class

CommentStorageController
Defines the controller class for comments.

Namespace

Drupal\comment

Code

protected function postDelete($comments) {

  // Delete the comments' replies.
  $query = db_select('comment', 'c')
    ->fields('c', array(
    'cid',
  ))
    ->condition('pid', array(
    array_keys($comments),
  ), 'IN');
  $child_cids = $query
    ->execute()
    ->fetchCol();
  entity_delete_multiple('comment', $child_cids);
  foreach ($comments as $comment) {
    $this
      ->updateNodeStatistics($comment->nid->target_id);
  }
}