/**
  * Update the number of comment for a comment
  *
  * @param null|\Sonata\NewsBundle\Model\PostInterface $post
  * @return void
  */
 public function updateCommentsCount(PostInterface $post = null)
 {
     $commentTableName = $this->em->getClassMetadata($this->getClass())->table['name'];
     $postTableName = $this->em->getClassMetadata($this->postManager->getClass())->table['name'];
     $this->em->getConnection()->query(sprintf('UPDATE %s p, (SELECT c.post_id, count(*) as total FROM %s as c WHERE c.status = 1 GROUP BY c.post_id) as count_comment
         SET p.comments_count = count_comment.total
         WHERE p.id = count_comment.post_id', $postTableName, $commentTableName));
 }