@param Criteria $criteria

@throws ApiException

@return CollectionResult
508023
protected function match(Criteria $criteria)
    {
        $response = $this->infakt->get($this->buildQuery($criteria));
        $data = \GuzzleHttp\json_decode($response->getBody()->getContents(), true);

        if (!(array_key_exists('metainfo', $data)
            && array_key_exists('total_count', $data['metainfo'])
            && array_key_exists('entities', $data))
        ) {
            throw new ApiException('Response does not contain required fields.');
        }

        $mapper = $this->getMapper();

        $collection = new CollectionResult();
        $collection->setTotalCount($data['metainfo']['total_count']);

        foreach ($data['entities'] as $entity) {
            $collection->addItemToCollection($mapper->map($entity));
        }

        return $collection;
    }
678039
public function findOneBy(array $criteria)
    {
        $query = $this->createQueryBuilder($criteria);
        if (!($object = $this->getOneOrNullResultFromQueryBuilder($query))) {
            $this->throwException('The resource was not found', 'not-found');
        }
        return $object;
    }
886864
public static function findOneByCriteria(array $criteria): ?self
    {
        try {
            list($columns, $values, $options) = static::parseCriteria($criteria);
        } catch (NoTagsException $e) {
            return null;
        }

        if (\count($columns) < 1) {
            return null;
        }

        return static::findOneBy($columns, $values, $options);
    }
90153
public function findOneBy($criteria)
    {
        $this->preFindOneBy();
        $entity =  $this->doFindOneBy($criteria);
        $this->postFindOneBy($entity);

        return $entity;
    }
894004
public function getByCriteria($criteria, $fieldName)
    {
        /** @var Statement $statement */
        $queryBuilder = $this->getSelectQueryBuilder();
        $queryBuilder->where($fieldName . " = :criteria");
        $queryBuilder->setParameter('criteria', $criteria);

        $statement = $queryBuilder->execute();
        $rows      = $statement->fetchAll();
        $this->prepareResults($rows);
        return $rows;
    }
435836
public function countByCriteria(Criteria $criteria)
    {
        $qb = $this->createCriteriaQueryBuilder($criteria, 'm');

        $qb->select('COUNT(m.id)');

        return $qb->getQuery()->getSingleScalarResult();
    }
366177
public static function distinct( $key , $criteria = array() )
    {

        self::processCriteriaWithType($criteria);
        $query = array('distinct'=>self::collectionName() , 'key' => $key , 'query' => $criteria);
        return self::connection()->distinct($query);

    }
938729
public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof ApiLogQuery) {
            return $criteria;
        }
        $query = new ApiLogQuery(null, null, $modelAlias);

        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }
1254543
public function findBy(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null)
    {
        return $this->findAll();
    }
804081
public function getPaginator(Criteria $criteria = null) {
		if ($criteria === null) {
			$criteria = $this->query();
		}
		
		return new Paginator(new AdapterCriteria($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;
    }
1165680
public function find($class, Criteria $criteria=null)
    {
        return new Collection($class,
            $this->query($criteria, $this->_pheasant->schema($class)->alias()));
    }
908075
public function delete($collection, array $criteria, $multi = TRUE)
	{
		$conds = $this->preprocessor->processCondition($criteria);

		$result = (int) $this->queryAdapter->delete($collection, $conds, $multi);

		$this->onQuery($collection, 'delete', ['criteria' => $conds, 'multi' => $multi], $result);

		return $result;
	}
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;
    }
1014215
public function find($criteria = null) {
		$criteria = $this->normalizeCriteria($criteria);
		$result   = $this->getTableModel()->find($criteria);
		
		if ($result->count() === 0) {
			return;
		}
		
		if ($this->getResultType() & self::RESULT_OBJECT) {
			$result->setHydrateMode(ResultsetSimple::HYDRATE_OBJECTS);
		} else {
			$result->setHydrateMode(ResultsetSimple::HYDRATE_ARRAYS);
		}
		
		return $this->createResultset($result);
	}
901292
public function pushCriteria($criteria)
    {
        if (is_string($criteria)) {
            $criteria = new $criteria;
        }
        if (!$criteria instanceof CriteriaInterface) {
            throw new RepositoryException("Class " . get_class($criteria) . " must be an instance of Prettus\\Repository\\Contracts\\CriteriaInterface");
        }
        $this->criteria->push($criteria);

        return $this;
    }
365879
public function matching(Criteria $criteria)
    {
        $allEntities = $this->wrapped->findAll();
        $collection = new ArrayCollection($allEntities);

        return $collection->matching($criteria);
    }