1.20.x comment.entity.inc protected CommentStorageController::postSave(EntityInterface $comment, $update)

Overrides EntityDatabaseStorageController::postSave().

Overrides EntityDatabaseStorageController::postSave

File

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

Class

CommentStorageController
Defines the controller class for comments.

Code

protected function postSave(EntityInterface $comment, $update) {
  // Update the {node_comment_statistics} table prior to executing the hook.
  $this->updateNodeStatistics($comment->nid);
  if ($comment->status == COMMENT_PUBLISHED) {
    module_invoke_all('comment_publish', $comment);
  }

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