Performs a COUNT query based on query criteria supplied from api request.

@param array $criteria

@return int
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();
    }
650307
public function count() {

        if (!$this->criteria) {

            $stmt = $this->collection->database->connection->query('SELECT COUNT(*) AS C FROM '.$this->collection->name);

        } else {

            $sql = ['SELECT COUNT(*) AS C FROM '.$this->collection->name];

            $sql[] = 'WHERE document_criteria("'.$this->criteria.'", document)';

            if ($this->limit) {
                $sql[] = 'LIMIT '.$this->limit;
            }

            $stmt = $this->collection->database->connection->query(\implode(' ', $sql));
        }

        $res  = $stmt->fetch(\PDO::FETCH_ASSOC);

        return intval(isset($res['C']) ? $res['C']:0);
    }
1007869
public function countPersonImages(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collPersonImagesPartial && !$this->isNew();
        if (null === $this->collPersonImages || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collPersonImages) {
                return 0;
            }

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

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

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

        return count($this->collPersonImages);
    }
907307
public function countDealerFolders(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collDealerFoldersPartial && !$this->isNew();
        if (null === $this->collDealerFolders || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collDealerFolders) {
                return 0;
            }

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

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

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

        return count($this->collDealerFolders);
    }
1174886
protected function getQueryCount(ICriteria $criteria) {

		$queryBuilder = $this->getEntityManager()->createQueryBuilder();
		
		// delegamos a cada dao espec�fico la creaci�n del query builder.
		$queryBuilder = $this->getQueryCountBuilder($criteria);

		$this->enhanceQueryBuild($queryBuilder, $criteria);
		
		//obtenemos el query del builder.
		return $queryBuilder->getQuery();
	}
929277
public function countLineagesRelatedByAncestorId(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collLineagesRelatedByAncestorIdPartial && !$this->isNew();
        if (null === $this->collLineagesRelatedByAncestorId || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collLineagesRelatedByAncestorId) {
                return 0;
            }

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

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

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

        return count($this->collLineagesRelatedByAncestorId);
    }
1167078
public function countMxmaps(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collMxmapsPartial && !$this->isNew();
        if (null === $this->collMxmaps || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collMxmaps) {
                return 0;
            }

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

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

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

        return count($this->collMxmaps);
    }
1116665
public function findOneOrNullBy(array $criteria)
    {

        $query = $this->createQueryBuilder($criteria);

        $object = $this->getOneOrNullResultFromQueryBuilder($query);

        return $object;
    }
966353
protected function _delete(array $criteria = array())
    {
        if (!is_null($this->_table)) {
            $this->_affectedRows = $this->_db->delete($this->_table, $criteria);
            return $this->_affectedRows;
        }
    }
80583
public function count(array $query = [])
    {
        $partial = Inflector::pluralize($this->getResourceName()).'/count';

        return $this->client->get($partial, $query)['count'];
    }
1256920
public function countAttributeTypeAvMetas(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collAttributeTypeAvMetasPartial && !$this->isNew();
        if (null === $this->collAttributeTypeAvMetas || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collAttributeTypeAvMetas) {
                return 0;
            }

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

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

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

        return count($this->collAttributeTypeAvMetas);
    }
406092
public function countFeatureTypeAvMetas(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collFeatureTypeAvMetasPartial && !$this->isNew();
        if (null === $this->collFeatureTypeAvMetas || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collFeatureTypeAvMetas) {
                return 0;
            }

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

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

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

        return count($this->collFeatureTypeAvMetas);
    }
588936
public function getURI(array $criteria)
    {
        $uris = $this->getURIs($criteria);

        return $uris->count() > 0
            ? $uris->first()
            : false;
    }
694074
public function countDealerSheduless(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collDealerShedulessPartial && !$this->isNew();
        if (null === $this->collDealerSheduless || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collDealerSheduless) {
                return 0;
            }

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

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

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

        return count($this->collDealerSheduless);
    }
55373
public function countParents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collParentsPartial && !$this->isNew();
        if (null === $this->collParents || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collParents) {
                return 0;
            }

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

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

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

        return count($this->collParents);
    }
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);
    }
462466
public function delete(string $table, array $criteria = []): int {
		
		// this one is like the insertSingle above in that it uses its parameters
		// to build a query.  unlike that one, we execute it here and return the
		// number of deleted rows.
		
		$statement = "DELETE FROM $table";
		
		if (sizeof($criteria) > 0) {
			
			// we want to take our column names and turn them into a string
			// like x=? AND y=? AND z=? so that we can tack it onto our
			// $statement
			
			$columns = array_keys($criteria);
			array_walk($columns, function(&$x) {
				$x = sprintf("%s%s%s = ?", $this->columnPrefix, $x, $this->columnSuffix);
			});
			$statement .= " WHERE " . join(" AND ", $columns);
		}
		
		$bindings = array_values($criteria);
		
		try {
			return $this->dbConn->fetchAffected($statement, $bindings);
		} catch (\PDOException $pdoException) {
			throw $this->prepareDatabaseException($pdoException, $statement, $bindings);
		}
	}