Count the number of records in the archive

@param array $data Data passed from the calling method

@return mixed
@throws \Nails\Common\Exception\FactoryException
547543
public function countAll($data)
    {
        $this->getCountCommonEmail($data);
        $oDb = Factory::service('Database');
        return $oDb->count_all_results($this->sTable . ' ' . $this->sTableAlias);
    }
830527
public function count()
    {
        return $this->collection->count() > $this->totalRecords ? $this->totalRecords : $this->collection->count();
    }
746725
public function getData($data = []) {
        for ($i = ((($this->_byPage * $this->_currentPage) - $this->_byPage)); $i <= (($this->_byPage * $this->_currentPage) - 1); $i++) {
            if (isset($data[$i])) {
                array_push($this->_data, $data[$i]);
            }
        }

        return $this->_data;
    }
1368519
public function validate(array $data)
    {
        $validator = $this->getValidator();
        if (!$validator->count()) {
            $method = new ReflectionMethod($this, 'validator');
            if ($method->getDeclaringClass()->getName() !== __CLASS__) {
                $validator = $this->validator();
            }
        }
        $this->_errors = $validator->errors($data);

        return count($this->_errors) === 0;
    }
1144418
public function create( $data )
	{
		$record = $this->fill( $data );

		if( is_array($record) )
		{
			$this->collection()->insert($record);
		}

		return $record;
	}
1109299
public static int count(final Object array) {

    if (isArray(array)) {
      return Array.getLength(array);
    } else if (array != null) {
      throw new IllegalArgumentException("Given data is not an array.");
    } else {
      return 0;
    }
  }
1211230
public function insert(array $data): int
    {
        $this->builder->setInsertData($data);
        $sql = $this->builder->buildSql();
        $this->builder = new QueryBuilder($this->pdo);
        return $this->execSql($sql);
    }
268751
public static function count($args = false)
    {
        /* @var ActiveRecord $model */

        $query = null;
        $model = new static();

        if ($args && $args instanceof Query) {
            $query = $args;
            //$query->from = " (SELECT T.".$model->getPkName()." FROM ".$model->getTableName()." T) TEMP";
            if (empty($query->from)) {
                $query->addFrom($model->getTableName().' T');
            }
            $query->select = 'T.'.$model->getPkName();
        } elseif ($args && is_array($args)) {
            if (!isset($args['from'])) {
                $args['from'] = $model->getTableName().' T';
            }
            $query = new Query($args);
            //$query->select = 'COUNT(*)';
            $query->select = 'T.'.$model->getPkName();
        } elseif (!$args) {
            $query = new Query(
                [
                    'from' => $model->getTableName().' T',
                    'select' => 'T.'.$model->getPkName(),
                ]
            );
        } else {
            throw new Exception(translate('Bad arguments'), 500, Exception::BADARGUMENTS);
        }

        $count_query = new Query(
            [
                'select' => 'COUNT(*)',
                'from' => '('.$query->toSql().') TC',
            ]
        );

        $stmt = $model->getDB()->prepare($count_query->toSql());
        $stmt->execute($query->params);
        $records = $stmt->fetchColumn();

        $stmt->closeCursor();

        return $records;
    }
369268
public function factory(array $data = [])
    {
        $model = $this->newQuery()->getModel()->newInstance();

        $this->setModelData($model, $data);

        return $model;
    }
436305
protected function limitCollection($data)
    {
        $results = [];
        foreach ($data as $key => $value) {
            if (is_array($value) === true && count($value) > $this->limit) {
                $value = array_slice($value, 0, $this->limit);
            }

            if ($value instanceof Collection && $value->count() > $this->limit) {
                $value = $value->take($this->limit);
            }

            $results[$key] = $value;
        }

        return $results;
    }
1045131
public function itemCount(array $condition, array $data)
    {
        if (!isset($data['product_id']) || !isset($data['bundle'])) {
            return false;
        }

        if (!is_array($data['bundle'])) {
            $data['bundle'] = explode(',', (string) $data['bundle']);
        }

        return $this->compare(count($data['bundle']), $condition['value'], $condition['operator']);
    }
1301831
public function countRecords(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collRecordsPartial && !$this->isNew();
        if (null === $this->collRecords || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collRecords) {
                return 0;
            }

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

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

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

        return count($this->collRecords);
    }
485684
public function update(array $data) : int
    {
        $table = $this->definition->getName();
        $columns = $this->definition->getFullColumns();
        $update = [];
        foreach ($data as $column => $value) {
            if (isset($columns[$column])) {
                $update[$column] = $this->normalizeValue($columns[$column], $value);
            }
        }
        if (!count($update)) {
            throw new DBException('No valid columns to update');
        }
        $sql = 'UPDATE '.$table.' SET ';
        $par = [];
        $sql .= implode(', ', array_map(function ($v) { return $v . ' = ?'; }, array_keys($update))) . ' ';
        $par = array_merge($par, array_values($update));
        if (count($this->where)) {
            $sql .= 'WHERE ';
            $tmp = [];
            foreach ($this->where as $v) {
                $tmp[] = $v[0];
                $par = array_merge($par, $v[1]);
            }
            $sql .= implode(' AND ', $tmp) . ' ';
        }
        if (count($this->order)) {
            $sql .= $this->order[0];
            $par = array_merge($par, $this->order[1]);
        }
        return $this->db->query($sql, $par)->affected();
    }
381138
public function getCountCommonObjectsFromTrash($data = [])
    {
        if (!empty($data['keywords'])) {

            if (!isset($data['or_like'])) {

                $data['or_like'] = [];
            }

            $data['or_like'][] = [
                'column' => 'o.filename_display',
                'value'  => $data['keywords'],
            ];
        }

        $this->getCountCommon($data);
    }
655966
public function count($params) {
        $orm = !is_null($params['ormObject']) ? $params['ormObject'] : ORM::for_table($params['table']);

        return $orm->count();
    }
1197648
public static function fromString($data)
    {
        $records = Collection::fromString($data)->toArray();

        if (!count($records)) {
            throw new RecordNotFound();
        }

        return $records[0];
    }
977241
protected function __apiStore (array $data = null)
    {
        if (is_null($data))
            $data = $this->getInputData();

        $record = HCPagesCategories::create(array_get($data, 'record'));
        $record->updateTranslations(array_get($data, 'translations'));

        return $this->apiShow($record->id);
    }