ModelBundle/Repository/ContentRepository.php
protected function countInContextByContentTypeSiteAndLanguage($contentType, $siteId, $language, PaginateFinderConfiguration $configuration = null, array $searchTypes = array())
    {
        $qa = $this->createAggregateQueryWithDeletedFilter(false);
        $qa->match($this->generateContentTypeFilter($contentType));
        $qa->match($this->generateSiteIdAndNotLinkedFilter($siteId));
        $qa->match($this->generateLanguageFilter($language));

        if (!is_null($configuration)) {
            $this->filterSearch($configuration, $qa, $searchTypes);
        }

        $qa = $this->generateLastVersionFilter($qa);

        return $this->countDocumentAggregateQuery($qa, self::ALIAS_FOR_GROUP);
    }
protected function countInContextByContentTypeSiteAndLanguage($contentType, $siteId, $language, PaginateFinderConfiguration $configuration = null, array $searchTypes = array())
    {
        $qa = $this->createAggregateQueryWithDeletedFilter(false);
        $qa->match($this->generateContentTypeFilter($contentType));
        $qa->match($this->generateSiteIdAndNotLinkedFilter($siteId));
        $qa->match($this->generateLanguageFilter($language));

        if (!is_null($configuration)) {
            $this->filterSearch($configuration, $qa, $searchTypes);
        }

        $qa = $this->generateLastVersionFilter($qa);

        return $this->countDocumentAggregateQuery($qa, self::ALIAS_FOR_GROUP);
    }
@param string                      $contentType
@param string                      $siteId
@param string                      $language
@param array                       $searchTypes
@param PaginateFinderConfiguration $configuration

@return int