@param array|SearchBuilder $criteria

@return bool|\Fei\ApiClient\ResponseDescriptor
336627
public function retrieve($criteria)
    {
        if ($criteria instanceof SearchBuilder) {
            $criteria = $criteria->getParams();
        }

        if (!is_array($criteria)) {
            throw new LoggerException('$criteria has to be of type array of SearchBuilder');
        }

        try {
            $this->registerErrorHandler();

            $request = new RequestDescriptor();

            $request->setUrl($this->buildUrl('/api/notifications?criteria=' . urlencode(json_encode($criteria))));
            $request->setMethod('GET');

            $return = $this->send($request, ApiRequestOption::NO_RESPONSE);

            $this->restoreErrorHandler();

            return $return;
        } catch (\Exception $e) {
            $this->writeToExceptionLogFile($e->getMessage());
            $this->restoreErrorHandler();
        }
    }
478505
private function createIndexQuery(array $criteria)
    {
        $query = new IndexQuery();

        foreach($criteria as $key => $value)
        {
            $query->addAndTerm($key, $value);
        }

        return $query->getQuery();
    }
511633
private function applyCriteriaToQueryBuilder(Criteria $criteria, QueryBuilder $qb, $prefix)
    {
        if ($criteria->getMode() === Criteria::MODE_OR) {
            $expr = $qb->expr()->orX();
        } else {
            $expr = $qb->expr()->andX();
        }
        foreach ($criteria as $criterium) {
            if ($criterium instanceof Criteria) {
                $expr->add(
                    $this->applyCriteriaToQueryBuilder($criterium, $qb, $prefix)
                );
            } else {
                $this->applyCriteriumToQueryBuilder($criterium, $qb, $expr, $prefix);
            }
        }

        return $expr;
    }
836099
public function findBy(array $criteria, ?array $sorting = null, $limit = null, $offset = null)
    {
        $queryBuilder = $this->getCollectionQueryBuilder();

        $this->applyCriteria($queryBuilder, $criteria);
        $this->applySorting($queryBuilder, $sorting);

        if (null !== $limit) {
            $queryBuilder->limit($limit);
        }

        if (null !== $offset) {
            $queryBuilder->skip($offset);
        }

        return $queryBuilder
            ->getQuery()
            ->getIterator()
        ;
    }
1009585
private function getLimitSql(Criteria $criteria)
    {
        $limit  = $criteria->getMaxResults();
        $offset = $criteria->getFirstResult();
        if ($limit !== null || $offset !== null) {
            return $this->platform->modifyLimitQuery('', $limit, $offset ?? 0);
        }

        return '';
    }
34571
public static function selectByRequest(array $criteria = [], array $options = [])
    {
        $criteria = static::cleanCriteria($criteria);
        $pk = static::getPrimaryKeyStatic();
        $selection = array_get($criteria, 'select');
        if (empty($selection)) {
            $selection = ['*'];
        }

        $related = array_get($options, ApiOptions::RELATED, []);
        if (is_string($related)) {
            $related = explode(',', $related);
        }

        $condition = array_get($criteria, 'condition');
        if (!empty($condition)) {
            $params = array_get($criteria, 'params');
            $builder = static::whereRaw($condition, $params)->with($related);
        } else {
            $builder = static::with($related);
        }

        if (!empty($limit = array_get($criteria, 'limit'))) {
            $builder->take($limit);
        }

        if (!empty($offset = array_get($criteria, 'offset'))) {
            $builder->skip($offset);
        }

        $orderBy = array_get($criteria, 'order', "$pk asc");
        $orders = explode(',', $orderBy);
        foreach ($orders as $order) {
            $order = trim($order);

            @list($column, $direction) = explode(' ', $order);
            if (empty($direction)) {
                $direction = 'ASC';
            }

            $builder = $builder->orderBy($column, $direction);
        }

        $groupBy = array_get($criteria, 'group');
        if (!empty($groupBy)) {
            $groups = explode(',', $groupBy);
            foreach ($groups as $group) {
                $builder = $builder->groupBy(trim($group));
            }
        }

        $response = $builder->get($selection);

        return static::cleanResult($response, array_get($criteria, 'select'));
    }
676482
public function delete(array $criteria = array()) {
        if (!$this->checkExists()) return false;

        $this->current = self::OP_DELETE;
        $this->query = 'DELETE FROM `' . $this->name . '`';
        if (!empty($criteria)) $this->query .= ' WHERE ';
        foreach ($criteria as $ky => $row) {
            $rowArray = $this->checkModel($row, false);
            $cnt = 0;
            foreach ($rowArray as $column => $value) {
                if (!is_object($value) && $value === null) {
                    continue;
                }
                $column = Util::camelTo_($column);

                if ($cnt) $this->query .= ' AND ';

                $this->query .= '`' . $column . '` = ?';
                $this->values[] = $value;
                $cnt++;
            }

            if ($ky < (count($criteria) - 1)) $this->query .= ' OR ';
        }

        if ($this->delayExecute) {
            return $this;
        }
        return $this->execute();
    }
356473
public function query($criteria=null)
    {
        $query = new \Pheasant\Query\Query($this->_connection);
        $query->from($this->_name);

        if(!is_null($criteria))
            $query->where($criteria);

        return $query;
    }
790920
public function load($criteria)
    {
        $pool       = $this->manager->getPool();
        $manager_id = $this->class->getManagerIdentifier();

        if (!is_array($criteria)) {
            $criteria = array($this->class->getFieldIdentifier() => $criteria);
        }

        $model = $pool->getManager($manager_id)
            ->getRepository($this->class->getFieldMapping($manager_id)->getName())
            ->findOneBy($criteria);

        if (null === $model) {
            return null;
        }

        $builder = new ModelBuilder($this->manager, $this->uow, $this->class);

        return $builder->build($model, $manager_id);
    }
1229984
public function matching(Criteria $criteria)
    {
        $persister = $this->_em->getUnitOfWork()->getEntityPersister($this->_entityName);

        return new LazyCriteriaCollection($persister, $criteria);
    }
344631
public function findOneBy(array $criteria) : ?array
    {
        foreach ($this->getSourceRows() as $row) {
            if ($this->matches($criteria, $row)) {
                return $row;
            }
        }

        return null;
    }
1334251
public function findByUnique($criteria)
    {
        if (!isset($criteria['slug'])) {
            return null;
        }

        return $this->_em->createQueryBuilder()
            ->select('p')
            ->from('VeonikBlogBundle:AbstractPost', 'p')
            ->where('p.slug = :slug')
            ->setParameter('slug', $criteria['slug'])
            ->getQuery()
            ->getResult();
    }
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;
    }
451279
public function matching(Criteria $criteria)
    {
        if ($this->isDirty) {
            $this->initialize();
        }

        if ($this->initialized) {
            return $this->collection->matching($criteria);
        }

        if ($this->association['type'] === ClassMetadata::MANY_TO_MANY) {
            $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association);

            return new ArrayCollection($persister->loadCriteria($this, $criteria));
        }

        $builder         = Criteria::expr();
        $ownerExpression = $builder->eq($this->backRefFieldName, $this->owner);
        $expression      = $criteria->getWhereExpression();
        $expression      = $expression ? $builder->andX($expression, $ownerExpression) : $ownerExpression;

        $criteria = clone $criteria;
        $criteria->where($expression);

        $persister = $this->em->getUnitOfWork()->getEntityPersister($this->association['targetEntity']);

        return ($this->association['fetch'] === ClassMetadataInfo::FETCH_EXTRA_LAZY)
            ? new LazyCriteriaCollection($persister, $criteria)
            : new ArrayCollection($persister->loadCriteria($criteria));
    }
954141
public function countBy(array $criteria = null)
    {
        /** @var \Doctrine\ORM\QueryBuilder $qb */
        $qb = $this->createQueryBuilder('e');
        $qb->select('count(e.id)');

        $firstCriteria = true;
        if (!empty($criteria)) {
            foreach ($criteria as $field => $value) {
                if ($firstCriteria) {
                    if ($value === null or $value === 'null') {
                        $qb->where("e.$field IS NULL");
                    } elseif ($value === 'not null') {
                        $qb->where("e.$field IS NOT NULL");
                    } else {
                        $qb->where("e.$field = :$field");
                        $qb->setParameter($field, $value);
                    }

                    $firstCriteria = false;
                } else {
                    if ($value === null or $value === 'null') {
                        $qb->andWhere("e.$field IS NULL");
                    } elseif ($value === 'not null') {
                        $qb->andWhere("e.$field IS NOT NULL");
                    } else {
                        $qb->andWhere("e.$field = :$field");
                        $qb->setParameter($field, $value);
                    }
                }
            }
        }

        return $qb->getQuery()->getSingleScalarResult();
    }
786450
protected function findWithCriteria(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $qb = $this->getLoadQuery();
        foreach ($criteria as $col => $val) {
            if (is_array($val)) {
                $qb->andWhere($this->getAlias() . ".$col IN(:$col)");
                $qb->setParameter(":$col", $val, Connection::PARAM_INT_ARRAY);
            } else {
                $qb->andWhere($this->getAlias() . ".$col = :$col");
                $qb->setParameter(":$col", $val);
            }
        }
        if ($orderBy) {
            $qb->orderBy($orderBy[0], $orderBy[1]);
        }
        if ($limit) {
            $qb->setMaxResults($limit);
        }
        if ($offset) {
            $qb->setFirstResult($offset);
        }

        return $qb;
    }
1060786
public function get($criteria)
    {
        foreach (array_merge($this->assemblers, $this->fallbackAssemblers) as $candidate) {
            $matcher = $candidate['matcher'];
            if ($matcher($criteria) === true) {
                return $candidate['assembler'];
            }
        }

        return null;
    }