1 comment.entity.inc protected CommentStorageController::postDelete($comments)

Overrides EntityDatabaseStorageController::postDelete().

Overrides EntityDatabaseStorageController::postDelete

File

core/modules/comment/comment.entity.inc, line 361
Entity controller and class for comments.

Class

CommentStorageController
Defines the controller class for comments.

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();
  comment_delete_multiple($child_cids);

  foreach ($comments as $comment) {
    $this->updateNodeStatistics($comment->nid);
    $nodes[] = $comment->nid;
  }

  // If entity caching is enabled on nodes, clear the cache for the nodes that
  // the deleted comments were on.
  $node_info = entity_get_info('node');
  if (isset($node_info['entity cache']) && $node_info['entity cache']) {
    foreach (array_unique($nodes) as $nid) {
      cache('entity_node')->delete($nid);
    }
  }

}