Count the number of trans unit.

@param array $locales
@param array $filters
@return int
516261
public function count(array $locales = null,  array $filters = null)
    {
        $builder = $this->createQueryBuilder();

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

        $count = $builder->count()
            ->getQuery()
            ->execute();

        return $count;
    }
715799
public function setFilters($filters)
    {
        if ($filters === null)
            $filters = [];
        else if (!is_array($filters))
            throw new \Exception('Filters should be null or array');

        foreach ($filters as $column => $filter) {
            $found = [];
            foreach ($this->getColumns() as $id => $params) {
                if ($id == $column) {
                    foreach ($filter as $name => $value) {
                        if (in_array($name, $params['filters']))
                            $found[$name] = $value;
                    }
                    break;
                }
            }

            if (count($found) > 0)
                $filters[$column] = $found;
            else
                unset($filters[$column]);
        }

        $this->filters = $filters;
        return $this;
    }
23507
public function count(array $filter = [], array $options = [])
    {
        $cursor = $this->executeCommand(
            ['count' => $this->collectionName, 'query' => (object) $filter],
            $options
        );

        $result = $cursor->current();
        if (!isset($result['n'])) {
            throw new UnexpectedResultException('Command "count" did not return expected "n" field.');
        }

        return (int) $result['n'];
    }
406257
protected function translate(array $filters, array $sorting = [], array $joins = [])
    {
        $constraints = [];

        foreach ($filters as $index => $filter) {
            if (array_key_exists('column', $filter) && array_key_exists('value', $filter)) {
                $constraints[] = $this->translateCriteria($filter, $joins);
                continue;
            }

            list($constraint, $sorting, $joins) = $this->translate($filter, $sorting, $joins);

            $this->translateOperation($index, $constraint, $constraints);
        }

        return [$constraints, $sorting, $joins];
    }
649484
public static function get_record($filters = array()) {
        global $DB;

        $record = $DB->get_record(static::TABLE, $filters);
        return $record ? new static(0, $record) : false;
    }
1253616
public function countProducts($filter = null)
	{
		$timeStamp = time();
		$wStr = '';
		$qStr = 'SELECT COUNT(' . $this->entity['p']['alias'] . ')'
			. ' FROM ' . $this->entity['p']['name'] . ' ' . $this->entity['p']['alias'];

		if ($filter != null) {
			$filterStr = $this->prepareWhere($filter);
			$wStr .= ' WHERE ' . $filterStr;
		}

		$qStr .= $wStr;
		$q = $this->em->createQuery($qStr);
		$result = $q->getSingleScalarResult();
		$count = 0;
		if (!$result) {
			$count = $result;
		}
		return new ModelResponse($count, 1, 0, null, false, 'S:D:003', 'Selected entries have been successfully inserted into database.', $timeStamp, time());
	}
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;
	}
1069873
public function countTotalOrders(array $baseIds = [], $filters = [])
    {
        $builder = $this->createQueryBuilder('o');
        $builder->select($builder->expr()->countDistinct('o.id'));
        $this->performQuery($builder, $baseIds, $filters);

        return $builder->getQuery()->getSingleScalarResult();
    }
87046
public function GetCount($Wheres = '') {
      $this->_BeforeGet();
      
      $this->SQL
         ->Select('*', 'count', 'Count')
         ->From($this->Name);

      if (is_array($Wheres))
         $this->SQL->Where($Wheres);

      $Data = $this->SQL
         ->Get()
         ->FirstRow();

      return $Data === FALSE ? 0 : $Data->Count;
   }
249935
public function count($filter = null)
    {
        try {
            return $this->select('COUNT(*)', $filter)->fetchColumn();
        } catch (\PDOException $e) {
            throw new StorageException($e->getMessage());
        }
    }
420976
public static function findLast(Filter ...$filters)
    {
        $results = static::find(...$filters);
        $modelClass = get_called_class();
        /** @var Model $model */
        $model = new $modelClass();
        $results->addSort($model->getUniqueIdentifierColumnName(), false);

        if (sizeof($results) == 0) {
            throw new RecordNotFoundException(get_called_class(), 0);
        }

        return $results[0];
    }
308885
public function getCounts($countables = [])
    {
        $counts = new CountableResults;

        $strategies = $this->buildCountableStrategies();

        // determine which countables to count for
        $countables = ( ! empty($countables))
                        ?   array_intersect($this->getCountables(), $countables)
                        :   $this->getActiveCountables();

        foreach ($countables as $parameterName) {

            // should we skip it no matter what?
            if ($this->isCountableIgnored($parameterName)) continue;

            $strategy = isset($strategies[$parameterName]) ? $strategies[$parameterName] : null;

            // normalize the strategy so that we can call_user_func on it
            if (is_a($strategy, ParameterCounterInterface::class)) {

                $strategy = [ $strategy, 'count' ];

            } elseif (is_null($strategy)) {
                // default, let it be handled by applyParameter

                $strategy = [ $this, 'countParameter' ];

            } elseif ( ! is_callable($strategy)) {

                throw new ParameterStrategyInvalidException(
                    "Invalid counting strategy defined for parameter '{$parameterName}',"
                    . " must be ParameterFilterInterface, classname, callable or null"
                );
            }

            // start with a fresh query
            $query = $this->getCountableBaseQuery();

            // apply the filter while temporarily ignoring the current countable parameter,
            // unless it is forced to be included
            $includeSelf = in_array($parameterName, $this->includeSelfInCount);

            if ( ! $includeSelf) {
                $this->ignoreParameter($parameterName);
            }

            $this->apply($query);

            if ( ! $includeSelf) {
                $this->unignoreParameter($parameterName);
            }

            // retrieve the count and put it in the results
            $counts->put($parameterName, call_user_func_array($strategy, [$parameterName, $query, $this]));
        }

        return $counts;
    }
1052485
public function filter(array $filters)
	{
		foreach ($filters as $filter) {
			if ($filter->isValueSet()) {
				if ($filter->hasConditionCallback()) {
					Callback::invokeArgs(
						$filter->getConditionCallback(),
						[$this->data_source, $filter->getValue()]
					);
				} else {
					if ($filter instanceof Filter\FilterText) {
						$this->applyFilterText($filter);
					} elseif ($filter instanceof Filter\FilterMultiSelect) {
						$this->applyFilterMultiSelect($filter);
					} elseif ($filter instanceof Filter\FilterSelect) {
						$this->applyFilterSelect($filter);
					} elseif ($filter instanceof Filter\FilterDate) {
						$this->applyFilterDate($filter);
					} elseif ($filter instanceof Filter\FilterDateRange) {
						$this->applyFilterDateRange($filter);
					} elseif ($filter instanceof Filter\FilterRange) {
						$this->applyFilterRange($filter);
					}
				}
			}
		}

		return $this;
	}
500263
public function withFilters(array $filters = null)
    {
        if ($filters) {
            foreach ($filters as $filter) {
                switch ($filter['type']) {
                    case 'select':
                        $this->select($filter['fields']);
                        break;
                    case 'andWhere':
                        $this->andWhere($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'orWhere':
                        $this->orWhere($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'andHaving':
                        $this->andHaving($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'orHaving':
                        $this->orHaving($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'addGroupBy':
                        $this->addGroupBy($filter['field']);
                        break;
                    case 'addOrderBy':
                        $this->addOrderBy($filter['field'], $filter['order']);
                        break;
                    case 'fkAddOrderBy':
                        $this->fkAddOrderBy($filter['field'], $filter['fkField'], $filter['order']);
                        break;
                    case 'paginate':
                        if (isset($filter['page'])) {
                            $this->paginate($filter['limit'], $filter['page']);
                        } else {
                            $this->paginate($filter['limit']);
                        }
                        break;
                }
            }
        }

        return $this;
    }
510435
public function count($tableSpec, array $filters = [])
    {
        $filters['_id.type'] = $tableSpec;
        return $this->getCollectionForTableSpec($tableSpec)->count($filters);
    }
719805
public static function getBrandsCount($filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCount('/brands/count' . $filter->toQuery());
    }
1161870
public function findForLocalesAndDomains(array $locales, array $domains)
    {
        return FileQuery::create()
            ->_if(count($locales) > 0)
                ->filterByLocale($locales, Criteria::IN)
            ->_endif()

            ->_if(count($domains) > 0)
                ->filterByDomain($domains, Criteria::IN)
            ->_endif()

            ->find($this->getConnection())
        ;
    }