Retrieve comment count for a specific post.

@param integer $postId

@return integer

@link http://codex.wordpress.org/XML-RPC_WordPress_API/Comments#wp.getCommentCount
975415
function getCommentCount($postId)
    {
        $params = array(1, $this->username, $this->password, $postId);

        return $this->sendRequest('wp.getCommentCount', $params);
    }
170640
public function getLastVersion($post_id)
	{
		$qb = $this->createQueryBuilder('p');
		
		$qb->where('p.original=:post_id')
			->orderBy('p.createdAt', 'DESC')
			->setParameter(':post_id', $post_id);
		
		$result = $qb->getQuery()->setMaxResults(1)->getResult(Query::HYDRATE_OBJECT);
		
		if ( is_null($result) ) {
			$qb2 = $this->createQueryBuilder('p');
			$qb2->where('p.id=:post_id')->setParameter(':post_id', $post_id);
			
			$result = $qb->getQuery()->getResult(Query::HYDRATE_OBJECT);
		}
		
		return $result;
	}
785996
public function getCommentsCount()
    {
        //check whether workshett name is set or not
        if ($this->worksheetName == '')
            throw new Exception('Worksheet name not specified');
        $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
            '/worksheets/' . $this->worksheetName . '/comments';
        $signedURI = Utils::sign($strURI);
        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
        $json = json_decode($responseStream);
        return count($json->Comments->CommentList);

    }
405845
protected function GetCommentTypeId()
    {
        if (false === $this->sPkgCommentTypeId) {
            $sQuery = "SELECT * FROM `pkg_comment_type` WHERE `pkg_comment_type`.`class_name` = 'TPkgCommentTypePkgShopArticleReview'";
            $oRes = MySqlLegacySupport::getInstance()->query($sQuery);
            if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) {
                $aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes);
                $this->sPkgCommentTypeId = $aRow['id'];
            } else {
                $this->sPkgCommentTypeId = '';
            }
        }

        return $this->sPkgCommentTypeId;
    }
1230249
public static function findPostsCount($id)
    {
        $cache = Podium::getInstance()->podiumCache->getElement('user.postscount', $id);
        if ($cache === false) {
            $cache = (new Query)->from(Post::tableName())->where(['author_id' => $id])->count();
            Podium::getInstance()->podiumCache->setElement('user.postscount', $id, $cache);
        }
        return $cache;
    }
13573
public function GetCommentCountSince($DiscussionID, $DateAllViewed) {
		// Only for members
		if(!Gdn::Session()->IsValid()) return;
		
		// Validate DiscussionID
		$DiscussionID = (int) $DiscussionID;
		if (!$DiscussionID)
			throw new Exception('A valid DiscussionID is required in GetCommentCountSince.');
		
		// Get new comment count
		return Gdn::Database()->SQL()
			->From('Comment c')
			->Where('DiscussionID', $DiscussionID)
			->Where('DateInserted >', Gdn_Format::ToDateTime($DateAllViewed))
			->GetCount();
	}
379895
public function GetCommentCounts() {
      $this->AllowJSONP(TRUE);
      
		$vanilla_identifier = GetValue('vanilla_identifier', $_GET);
		if (!is_array($vanilla_identifier))
			$vanilla_identifier = array($vanilla_identifier);
         
      $vanilla_identifier = array_unique($vanilla_identifier);
      
      $FinalData = array_fill_keys($vanilla_identifier, 0);
      $Misses = array();
      $CacheKey = 'embed.comments.count.%s';
      $OriginalIDs = array();
      foreach ($vanilla_identifier as $ForeignID) {
         $HashedForeignID = ForeignIDHash($ForeignID);
         
         // Keep record of non-hashed identifiers for the reply
         $OriginalIDs[$HashedForeignID] = $ForeignID;
         
         $RealCacheKey = sprintf($CacheKey, $HashedForeignID);
         $Comments = Gdn::Cache()->Get($RealCacheKey);
         if ($Comments !== Gdn_Cache::CACHEOP_FAILURE)
            $FinalData[$ForeignID] = $Comments;
         else
            $Misses[] = $HashedForeignID;
      }
      
      if (sizeof($Misses)) {
         $CountData = Gdn::SQL()
            ->Select('ForeignID, CountComments')
            ->From('Discussion')
            ->Where('Type', 'page')
            ->WhereIn('ForeignID', $Misses)
            ->Get()->ResultArray();
         
         foreach ($CountData as $Row) {
            // Get original identifier to send back
            $ForeignID = $OriginalIDs[$Row['ForeignID']];
            $FinalData[$ForeignID] = $Row['CountComments'];
            
            // Cache using the hashed identifier
            $RealCacheKey = sprintf($CacheKey, $Row['ForeignID']);
            Gdn::Cache()->Store($RealCacheKey, $Row['CountComments'], array(
               Gdn_Cache::FEATURE_EXPIRY     => 60
            ));
         }         
      }
      
		$this->SetData('CountData', $FinalData);
		$this->DeliveryMethod = DELIVERY_METHOD_JSON;
		$this->DeliveryType = DELIVERY_TYPE_DATA;
		$this->Render();
	}
710717
public function getPageSlug(int $postId)
    {
        $slug = get_permalink($postId);
        $slug = str_replace(home_url(), '', $slug);
        $slug = trim($slug, '/');

        return $slug;
    }
880812
public function countComments($countUnpublished = false)
    {
        $countComments = 0;

        if ($countUnpublished) {
            $countComments = $this->getComments()
                    ->count();
        } else {
            foreach ($this->getComments() as $comment) {
                if ($comment->isPublished()) {
                    ++$countComments;
                }
            }
        }

        return $countComments;
    }
284480
public function getCommentsForPostvote($postvote)
    {
        $postvoteCommentMapper = $this->getPostVoteCommentMapper();
        $comments = $postvoteCommentMapper->findBy(array('postvote' => $postvote), array('createdAt' => 'DESC'));

        return $comments ;
    }
523478
public function actionIndexPost($id=NULL)
	{
		if ($id === NULL)
			return $this->createComment();
		else
			return $this->updateComment($id);
	}
471013
public function postsCount($id)
    {
        // I know eloquent does this, but having trouble so hand crafting using DB
        // Note the use of a pivot table due tot he "many" relationship
        $record =  DB::table('post_tag')->where('tag_id', '=', $id)->get();
        return count($record);
    }
56686
public function indexComments($postId, EncodingParametersInterface $parameters)
    {
        $this->getLogger()->debug('Index post comments started.', [Post::FIELD_ID => $postId]);

        $result = $this->indexRelationship($postId, Post::REL_COMMENTS, $parameters);

        $this->getLogger()->debug('Index post comments completed.');

        return $result;
    }
73333
public function getCommentCount()
    {
        return count(Comment::findAll([
            'parent_id' => $this->id,
            'model' => self::COMMENT_FOR,
            'status' => Comment::STATUS_APPROVED
        ]));
    }
611179
public function updateComment(int $commentId, string $content): bool
    {
        if ('' === $content || ! $this->validateId($commentId)) {
            return false;
        }

        $data   = $this->prepareRequestData(['content' => $content]);
        $result = $this->post('comments/' . $commentId, $data);

        return 204 === $result->getStatusCode();
    }
162429
public function findComment($commentOrId)
    {
        if ($commentOrId instanceof CommentInterface) {
            $commentOrId = $commentOrId->getId();
        }
        
        $application = $this->findOneBy(array('comments.id' => $commentOrId));
        /* @var \Applications\Entity\Comment $comment */
        foreach ($application->getComments() as $comment) {
            if ($comment->getId() == $commentOrId) {
                return $comment;
            }
        }
        return null;
    }
59365
public function count($blogId, array $params = array())
    {
        $endpoint = '/admin/blogs/'.$blogId.'/articles/count.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $response['count'];
    }