Returns total results count for $criterion and $sortClauses.

@param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
@param array $languageFilter

@return array
343627
protected function getTotalCount(Criterion $criterion, array $languageFilter)
    {
        $query = $this->handler->createSelectQuery();
        $query
            ->select($query->alias($query->expr->count('*'), 'count'))
            ->from($this->handler->quoteTable('ezcontentobject_tree'))
            ->innerJoin(
                'ezcontentobject',
                'ezcontentobject_tree.contentobject_id',
                'ezcontentobject.id'
            )
            ->innerJoin(
                'ezcontentobject_version',
                'ezcontentobject.id',
                'ezcontentobject_version.contentobject_id'
            );

        $query->where(
            $this->criteriaConverter->convertCriteria($query, $criterion, $languageFilter),
            $query->expr->eq(
                'ezcontentobject.status',
                //ContentInfo::STATUS_PUBLISHED
                $query->bindValue(1, null, PDO::PARAM_INT)
            ),
            $query->expr->eq(
                'ezcontentobject_version.status',
                //VersionInfo::STATUS_PUBLISHED
                $query->bindValue(1, null, PDO::PARAM_INT)
            ),
            $query->expr->neq(
                $this->handler->quoteColumn('depth', 'ezcontentobject_tree'),
                $query->bindValue(0, null, PDO::PARAM_INT)
            )
        );

        // If not main-languages query
        if (!empty($languageFilter['languages'])) {
            $query->where(
                $query->expr->gt(
                    $query->expr->bitAnd(
                        $this->handler->quoteColumn('language_mask', 'ezcontentobject'),
                        $query->bindValue(
                            $this->getLanguageMask($languageFilter),
                            null,
                            PDO::PARAM_INT
                        )
                    ),
                    $query->bindValue(0, null, PDO::PARAM_INT)
                )
            );
        }

        $statement = $query->prepare();
        $statement->execute();

        return (int)$statement->fetchColumn();
    }
114006
public function countDealerContactInfoI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collDealerContactInfoI18nsPartial && !$this->isNew();
        if (null === $this->collDealerContactInfoI18ns || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collDealerContactInfoI18ns) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getDealerContactInfoI18ns());
            }

            $query = ChildDealerContactInfoI18nQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByDealerContactInfo($this)
                ->count($con);
        }

        return count($this->collDealerContactInfoI18ns);
    }
935212
public function countVariations(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collVariationsPartial && !$this->isNew();
        if (null === $this->collVariations || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collVariations) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getVariations());
            }

            $query = ChildSkillQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByVariationOf($this)
                ->count($con);
        }

        return count($this->collVariations);
    }
257523
public function canVisit(Criterion $criterion)
    {
        return
            $criterion instanceof Criterion\ContentTypeIdentifier &&
            (
                ($criterion->operator ?: Operator::IN) === Operator::IN ||
                $criterion->operator === Operator::EQ
            );
    }
73398
public function canVisit(Criterion $criterion)
    {
        return
            $criterion instanceof Criterion\Location\IsMainLocation && $criterion->operator === Operator::EQ;
    }
1229587
protected function parseCriterion(array $criterionData): Criterion
    {
        return new Criterion([
            Criterion::ATTRIBUTE => $criterionData[0] ?? null,
            Criterion::OPERATOR => $criterionData[1] ?? null,
            Criterion::VALUE => $criterionData[2] ?? null,
            Criterion::BOOLEAN => $criterionData[3] ?? 'and',
        ]);
    }
988982
public function count(array $locales = null,  array $filters = null)
    {
        $this->loadCustomHydrator();

        $builder = $this->createQueryBuilder('tu')
            ->select('COUNT(DISTINCT tu.id) AS number');

        $this->addTransUnitFilters($builder, $filters);
        $this->addTranslationFilter($builder, $locales, $filters);

        return (int) $builder->getQuery()->getResult(Query::HYDRATE_SINGLE_SCALAR);
    }
417564
public function canVisit(Criterion $criterion)
    {
        return
            $criterion instanceof Criterion\SectionId &&
            (
                ($criterion->operator ?: Operator::IN) === Operator::IN ||
                $criterion->operator === Operator::EQ
            );
    }
1055826
protected function getCondition(Criterion $criterion)
    {
        if (count($criterion->value) > 1) {
            return array(
                'terms' => array(
                    'locations_doc.remote_id_id' => $criterion->value,
                ),
            );
        } else {
            return array(
                'term' => array(
                    'locations_doc.remote_id_id' => $criterion->value[0],
                ),
            );
        }
    }
965685
public static function countByRequest(array $criteria = [])
    {
        if (!empty($condition = array_get($criteria, 'condition'))) {
            $params = array_get($criteria, 'params', []);

            return static::whereRaw($condition, $params)->count();
        }

        return static::count();
    }
116816
public function countCustomerGroupI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collCustomerGroupI18nsPartial && !$this->isNew();
        if (null === $this->collCustomerGroupI18ns || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collCustomerGroupI18ns) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getCustomerGroupI18ns());
            }

            $query = ChildCustomerGroupI18nQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByCustomerGroup($this)
                ->count($con);
        }

        return count($this->collCustomerGroupI18ns);
    }
792705
private function getSectionFilterCriteria(ParameterCollectionInterface $parameterCollection): ?Criterion
    {
        if ($parameterCollection->getParameter('filter_by_section')->getValue() !== true) {
            return null;
        }

        $sections = $parameterCollection->getParameter('sections')->getValue() ?? [];
        if (count($sections) === 0) {
            return null;
        }

        return new Criterion\SectionId($this->getSectionIds($sections));
    }
334627
public function count($filter=NULL, array $options=NULL, $ttl=60) {
		$has=$this->hasCond;
		$count=$this->filteredFind($filter,$options,$ttl,true);
		$this->hasCond=$has;
		return $count;
	}
523687
public function countCustomers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collCustomersPartial && !$this->isNew();
        if (null === $this->collCustomers || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collCustomers) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getCustomers());
            }
            $query = CustomerQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByCountry($this)
                ->count($con);
        }

        return count($this->collCustomers);
    }
1244033
public function countAttributeTypeI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collAttributeTypeI18nsPartial && !$this->isNew();
        if (null === $this->collAttributeTypeI18ns || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collAttributeTypeI18ns) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getAttributeTypeI18ns());
            }

            $query = ChildAttributeTypeI18nQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByAttributeType($this)
                ->count($con);
        }

        return count($this->collAttributeTypeI18ns);
    }
701311
public function countSkillsRelatedByStartPositionId(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collSkillsRelatedByStartPositionIdPartial && !$this->isNew();
        if (null === $this->collSkillsRelatedByStartPositionId || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collSkillsRelatedByStartPositionId) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getSkillsRelatedByStartPositionId());
            }

            $query = ChildSkillQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByStartPosition($this)
                ->count($con);
        }

        return count($this->collSkillsRelatedByStartPositionId);
    }
1219694
public function canVisit(Criterion $criterion)
    {
        return
            $criterion instanceof Criterion\Field &&
            (
                ($criterion->operator ?: Operator::IN) === Operator::IN ||
                $criterion->operator === Operator::EQ ||
                $criterion->operator === Operator::CONTAINS
            );
    }