Add an array of criteria to the expression as AND clauses.

@see QueryBuilder::addCriteria()

@param array $criteria values indexed by property name

@return QueryBuilder|$this
420571
public function addCriteria(array $criteria)
    {
        foreach ($criteria as $key => $value) {
            $this->attr($key)->matches($value);
        }

        return $this;
    }
846064
public function criteria(Criteria\Criteria $cri = null)
    {
        if (! $cri) $cri = new Criteria\Criteria($this);
        $cri->setTable($this);

        return $cri;
    }
110361
public function registerCriteriaFunction($criteria) {

        $id = \uniqid('criteria');

        if (\is_callable($criteria)) {
           $this->document_criterias[$id] = $criteria;
           return $id;
        }

        if (is_array($criteria)) {

            $fn = null;

            eval('$fn = function($document) { return '.UtilArrayQuery::buildCondition($criteria).'; };');

            $this->document_criterias[$id] = $fn;

            return $id;
        }

        return null;
    }
259952
public void addQueryCriterion(QueryCriterion criterion){
        if( criteria == null){
            criteria = new ArrayList<QueryCriterion>();
        }
        criteria.add(criterion);
    }
998311
public function append($operator, Criteria $criteria)
    {
        $this->children[] = new Node(self::TYPE_LEAF, $operator, $criteria);
        $this->mostRecentCriteria = $criteria;

        return $this;
    }
149475
public function wrap($criteria) {
        if ($criteria instanceof xPDOQuery) {
            $this->_class= $criteria->_class;
            $this->_alias= $criteria->_alias;
            $this->graph= $criteria->graph;
            $this->query= $criteria->query;
        }
        $this->sql= $criteria->sql;
        $this->stmt= $criteria->stmt;
        $this->bindings= $criteria->bindings;
        $this->cacheFlag= $criteria->cacheFlag;
    }
214677
public function addOr(AbstractCriterion $criterion)
    {
        $this->clauses[] = $criterion;
        $this->conjunctions[] = self::ODER;

        return $this;
    }
685617
public function addCriteria($criteria = null, $operator = 'AND')
    {
        if ($criteria instanceof Criteria) {
            $query = $criteria->getQuery();
            // 添加 WHERE 条件
            isset($query['where']) && $this->addWhere($query['where'], $criteria->getParams(), $operator);
        }
        return $this;
    }
1119345
protected function applyCriteria(QueryBuilder $queryBuilder, array $criteria = [])
    {
        foreach ($criteria as $property => $value) {
            $name = $this->getPropertyName($property);
            if (null === $value) {
                $queryBuilder->andWhere($queryBuilder->expr()->isNull($name));
            } elseif (is_array($value)) {
                $queryBuilder->andWhere($queryBuilder->expr()->in($name, $value));
            } elseif ('' !== $value) {
                $parameter = str_replace('.', '_', $property);
                $queryBuilder
                    ->andWhere($queryBuilder->expr()->eq($name, ':'.$parameter))
                    ->setParameter($parameter, $value)
                ;
            }
        }
    }
1226381
private function appendSearch(QueryBuilder $builder, array $criteria)
    {
        if (false === $this->isSearchQuery($criteria)) {
            return $this;
        }
        $builder->selectMeta('searchScore', 'textScore');
        $builder->sortMeta('searchScore', 'textScore');
        return $this;
    }
424075
public function search(array $criteria = array())
    {

        /** @var Statement $statement */
        $maxResults   = isset($criteria['maxResults']) ? intval($criteria['maxResults']) : self::MAX_RESULTS;
        $where        = isset($criteria['where']) ? $criteria['where'] : null;
        $queryBuilder = $this->getSelectQueryBuilder();
        //        $returnType   = isset($criteria['returnType']) ? $criteria['returnType'] : null;

        // add filter (https://trac.wheregroup.com/cp/issues/3733)
        if (!empty($this->sqlFilter)) {
            $queryBuilder->andWhere($this->sqlFilter);
        }

        // add second filter (https://trac.wheregroup.com/cp/issues/4643)
        if ($where) {
            $queryBuilder->andWhere($where);
        }

        $queryBuilder->setMaxResults($maxResults);
        // $queryBuilder->setParameters($params);
        $statement  = $queryBuilder->execute();
        $rows       = $statement->fetchAll();
        $hasResults = count($rows) > 0;

        // Cast array to DataItem array list
        if ($hasResults) {
            $this->prepareResults($rows);
        }

        return $rows;
    }
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) . '"');
	}
932662
public function addCriteria(Criteria $criteria) : void
    {
        if (! $this->isValidFilter($criteria->getOperator())) {
            throw new \RuntimeException(sprintf('Invalid filter provided: %s', $criteria->getOperator()));
        }

        $this->criteria[] = $criteria;
    }
283
public function find($criteria = array())
    {
        if (!is_array($criteria)) {
            $criteria = array(
                '$id' => $criteria,
            );
        }

        // wrap criteria as NObject instance to make sure it can be override by hooks
        $criteria = new NObject($criteria);

        $this->applyHook('searching', $criteria);
        $cursor = $this->connection->query($this, $criteria->toArray());
        $this->applyHook('searched', $cursor);

        return $cursor;
    }
1347074
public function addCriteria($criteria, $operator = 'AND')
    {
        if (!$criteria instanceof Criteria) {
            return $this;
        }
        $query = $criteria->getQuery();
        // distinct
        isset($query['distinct']) && $this->setDistinct($query['distinct']);
        // select
        isset($query['select']) && !empty($query['select']) && $this->addSelect($query['select']);
        // table
        isset($query['table']) && !empty($query['table']) && $this->setTable($query['table']);
        // alias
        isset($query['alias']) && !empty($query['alias']) && $this->setAlias($query['alias']);
        // join
        if (isset($query['join']) && !empty($query['join'])) {
            foreach ($query['join'] as $join) {
                $this->addJoin($join);
            }
        }
        // where
        // 添加 WHERE 条件
        isset($query['where']) && $this->addWhere($query['where'], [], $operator);
        // group
        isset($query['group']) && !empty($query['group']) && $this->setGroup($query['group']);
        // having
        isset($query['having']) && !empty($query['having']) && $this->setHaving($query['having']);
        // union
        if (isset($query['union']) && !empty($query['union'])) {
            foreach ($query['union'] as $union) {
                $this->addUnion($union);
            }
        }
        // order
        isset($query['order']) && !empty($query['order']) && $this->setOrder($query['order']);
        // limit
        isset($query['limit']) && $this->setLimit($query['limit']);
        // offset
        isset($query['offset']) && $this->setOffset($query['offset']);
        // bind params
        $this->addParams($criteria->getParams());

        return $this;
    }
296903
public function groupBy($criteria)
    {
        $criteria = $this->factoryCallableCriteria($criteria);
        $groups   = $this->create();

        $this->each(function ($element, $key) use ($groups, $criteria) {
            $groupName  = $criteria($element, $key);
            $elements   = $groups->offsetGet($groupName, array());
            $elements[] = $element;
            $groups[$groupName] = $elements;
        });

        return $groups;
    }
277808
public function find($criteria = [], array $fields = []) {
		$criteriaNormalized = $this->normalizeCriteria($criteria);
		
		$mongoCursor = $this->getAdapter()->find(
			$this->getTableName(),
			$criteriaNormalized,
			$fields
		);
		
		if ($criteria instanceof Criteria) {
			$this->applyCriteriaToCursor($criteria, $mongoCursor);
		}
		
		return $this->createResultset($mongoCursor);
	}