@param array $criteria Criterios de la consulta DELETE adoptados en el WHERE

@return int Filas afectadas
966353
protected function _delete(array $criteria = array())
    {
        if (!is_null($this->_table)) {
            $this->_affectedRows = $this->_db->delete($this->_table, $criteria);
            return $this->_affectedRows;
        }
    }
514576
public function prepareCriteria($criteria)
    {
        if (is_null($criteria)) {
            $criteria = array();
        }

        if (array_key_exists('$id', $criteria)) {
            $criteria['id'] = $criteria['$id'];
            unset($criteria['$id']);
        }

        return $criteria ? : array();
    }
567339
protected function normalizeCriteria($criteria) {
		if ($criteria === null) {
			return;
		}
		
		if ($criteria instanceof Criteria) {
			return $criteria->getInnerCriteria()->getParams();
		}
		
		if ($criteria instanceof PhalconCriteria) {
			return $criteria->getParams();
		}
		
		if (is_array($criteria) || is_string($criteria) || is_int($criteria)) {
			return $criteria;
		}
		
		throw new InvalidCriteria('Invalid type of the criteria: "' . gettype($criteria) . '"');
	}
17278
public function countRecordsInTableMatching($table, $criteria = []): int
    {
        $where = '';
        foreach ($criteria as $field => $vale) {
            if ($where) {
                $where .= ' AND ';
            }
            if ($vale === null) {
                $where .= sprintf('%s IS NULL', $field);
            } else {
                $where .= sprintf('%s = :%s', $field, $field);
            }
        }
        $query = sprintf('SELECT count(*) AS records FROM %s WHERE %s', $table, $where);

        /** @var EntityManager $manager */
        $manager = $this->client->getContainer()->get('doctrine')->getManager();
        $rsm = new ResultSetMapping();
        $rsm->addScalarResult('records', 'records', 'integer');
        $query = $manager->createNativeQuery($query, $rsm);
        $query->setParameters($criteria);

        return (int) $query->getSingleScalarResult();
    }
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();
	}
34634
public function countSkillGroups(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collSkillGroupsPartial && !$this->isNew();
        if (null === $this->collSkillGroups || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collSkillGroups) {
                return 0;
            }

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

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

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

        return count($this->collSkillGroups);
    }
1026570
public function searchOne(array $criterias = array())
    {
        $results = $this->search($criterias, 1);

        if (count($results) !== 1) {
            return null;
        }

        return $results[0];
    }
649035
public function delete(array $criteria = [])
    {
        $this->viewCheck(__FUNCTION__);

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

        $old = clone $this;
        if (!$this->beforeDelete($criteria))
            return false;

        if ($result = $this->run($query, $criteria))
            $this->next();

        if (!$this->afterDelete($old))
            return false;

        return $result;
    }
331639
public function remove($criteria = array(), array $options = array())
    {
        if ($criteria) {
            $query = new Query($criteria, $this);
            $query->compress();
            $criteria = $query->compressed;
        }

        return $this->native->remove($criteria, $options);
    }
1130312
public function seeUserInDatabase(array $criteria)
    {
        $tableName = $this->grabPrefixedTableNameFor('users');
        $allCriteria = $criteria;
        if (!empty($criteria['user_pass'])) {
            $userPass = $criteria['user_pass'];
            unset($criteria['user_pass']);
            $hashedPass = $this->grabFromDatabase($tableName, 'user_pass', $criteria);
            $passwordOk = WpPassword::instance()->check($userPass, $hashedPass);
            $this->assertTrue(
                $passwordOk,
                'No matching records found for criteria ' . json_encode($allCriteria) . ' in table ' . $tableName
            );
        }
        $this->seeInDatabase($tableName, $criteria);
    }
602043
public function matching(Criteria $criteria)
    {
        $this->guardAgainstInvalidGivenType();
        $elements = $this->collection->matching($criteria)->toArray();

        return $this->create($elements);
    }
1179061
public static function findByCriteria(array $criteria): ?Model\Collection
    {
        try {
            list($columns, $values, $options) = static::parseCriteria($criteria);
        } catch (NoTagsException $e) {
            return null;
        }

        if (\count($columns) < 1) {
            return static::findAll($options);
        }

        return static::findBy($columns, $values, $options);
    }
176697
public function findOneBy(array $criteria)
    {
        $elements = $this->findBy($criteria);
        return !empty($elements) ? reset($elements) : null;
    }
913504
public function findAll($criteria = [])
    {
        is_array($criteria) || ($criteria = []);
        $query = 'SELECT * FROM ' . static::TABLE;

        if (isset($criteria['orderby'])) {
            $query .= ' ORDER BY ' . $criteria['orderby'];
        }

        $stmt = AbstractApp::getDbal()->query($query);
        $list = [];

        $primary = $this->getPrimaryKey();

        if ($primary) {
            while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                $list[$row[$primary]] = $row;
            }
        }
        else {
            while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                $list[] = $row;
            }
        }

        return $this->extend($list, true);
    }
611831
public function getAmountOfArticles(Criteria $criteria = null) : int
    {
        return $this->blogArticleRepo->countMatching($criteria ?? $this->criteria());
    }
1282964
public function getPlainSelectedColumns(Criteria $criteria)
    {
        $selected = [];
        foreach ($criteria->getSelectColumns() as $columnName) {
            if (false === strpos($columnName, '(')) {
                $selected[] = $columnName;
            }
        }

        foreach ($criteria->getAsColumns() as $alias => $col) {
            if (false === strpos($col, '(') && !in_array($col, $selected)) {
                $selected[] = $col;
            }
        }

        return $selected;
    }
638649
public function countMultiples(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collMultiplesPartial && !$this->isNew();
        if (null === $this->collMultiples || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collMultiples) {
                return 0;
            }

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

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

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

        return count($this->collMultiples);
    }