Gets Entities by criteria ...

@param array $criteria
@param array $orders
@param int   $limit
@param int   $offset

@return array
506524
public function getEntitiesBy(array $criteria = [], array $orders = [], $limit = null, $offset = null): array
    {
        $entities = $this->getRepository()->findBy($criteria, $orders, $limit, $offset);
        $this->prepareEntitesForGet($entities);

        return $entities;
    }
1242178
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $query = $this->createQueryBuilder($criteria, $orderBy, $limit, $offset);
        return $this->getResultFromQueryBuilder($query);
    }
993764
public function complexFindOneBy(array $criteria, array $orderBy = [])
    {
        $qb = $this->createQueryBuilder("p");

        foreach($criteria as $c => $v){
            $qb->andWhere("p.$c $v");
        }
        foreach($orderBy as $c => $v){
            $qb->addOrderBy("p.".$c,$v);
        }
        $qb->setMaxResults(1);
        return $qb->getQuery()->getResult()[0] ?? null;
    }
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'));
    }
1012141
public function getList($limit, $offset = 0)
    {
        return $this->getEntityManager()->createQuery('
            SELECT
                n
            FROM
                AnimeDbAppBundle:Notice n
            ORDER BY
                n.date_created DESC
        ')
            ->setFirstResult($offset)
            ->setMaxResults($limit)
            ->getResult();
    }
1092409
public function complexFindBy(array $criteria, array $orderBy = [], $limit = null, $offset = null)
    {
        $qb = $this->createQueryBuilder("p");

        foreach($criteria as $c => $v){
            $qb->andWhere("p.$c $v");
        }
        foreach($orderBy as $c => $v){
            $qb->addOrderBy("p.".$c,$v);
        }
        if (isset($limit)) $qb->setMaxResults($limit);
        if (isset($offset)) $qb->setFirstResult($offset);

        return $qb->getQuery()->getResult();
    }
878029
function find(array $where = null, $order = null, $limit = 0, $offset = 0, $lock = null) {
		$query = $this->getQueryWriter()->reset();
		$query->write("SELECT * FROM", $this->conn->quoteName($this->name));
		if ($where) {
			$query->write("WHERE")->criteria($where);
		}
		if ($order) {
			$query->write("ORDER BY", $order);
		}
		if ($limit) {
			$query->write("LIMIT", $limit);
		}
		if ($offset) {
			$query->write("OFFSET", $offset);
		}
		if ($lock) {
			$query->write("FOR", $lock);
		}
		return $this->execute($query);
	}
1267010
protected function setFetchOptions(&$fetch, $limit, $order, $offset)
    {
        if (!is_null($limit)) {
            $fetch->limit($limit);
        }
        if (!is_null($offset)) {
            $fetch->offset($offset);
        }
        if (!is_null($order)) {
            $fetch->clearOrderBy($order);
            if (is_array($order)) {
                $fetch->order($order[0], $order[1]);
            } else {
                $fetch->order($order);
            }
        }
        return $fetch;
    }
964700
public function search(SearchCriteria $criteria, $limit = null, $offset = 0)
    {
        $actor = $criteria->actor;

        $query = $this->pages->query();

        if ($actor !== null && !$actor->isAdmin()) {
            $query->whereIsHidden(0);
        }

        $search = new PageSearch($query->getQuery(), $actor);

        $this->gambits->apply($search, $criteria->query);
        $this->applySort($search, $criteria->sort);
        $this->applyOffset($search, $offset);
        $this->applyLimit($search, $limit + 1);

        $pages = $query->get();

        if ($areMoreResults = ($limit > 0 && $pages->count() > $limit)) {
            $pages->pop();
        }

        return new SearchResults($pages, $areMoreResults);
    }
877703
public function getFranchises($offset = 0, $limit = 25)
    {
        list($offset, $limit) = $this->normalizeOffsetAndLimit($offset, $limit);

        return $this->request('franchises', [
            'offset' => $offset,
            'limit' => $limit,
        ]);
    }
1188752
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null, $indexBy = null)
    {
        $this->checkRepository();

        $data = parent::findBy($criteria, $orderBy, $limit, $offset);

        if ($data && $indexBy) {
            $data = $this->sortCollection($data, $indexBy);
        }

        return $data;
    }
391723
protected function createPaginatedQueryBuilder(array $criteria = [], $indexBy = null, array $orderBy = null)
    {
        $qb = new PaginatedQueryBuilder($this->_em);
        $qb->from($this->_entityName, $this->getEntityAlias(), $indexBy);

        $this->processCriteria($qb, $criteria);

        return $qb;
    }
283303
public function findOneBy(array $criteria = [], array $orders = [], $offset = null): ?AbstractEntity
    {
        $array = $this->findBy($criteria, $orders, 1, $offset);

        return array_shift($array);
    }
755908
public function retrieveAll(array $filters = array(), $limit = null, $offset = null)
    {
        $result = clone $this->entityCollection;
        if (!empty($filters)) {
            $result = $result->search($filters);
        }
        if ($offset) {
            $result = $result->cslice($offset, $limit);
        }
        if ($limit && !$offset) {
            $result = $result->chunk($limit);
        }

        return $result;
    }
676275
public function findPaginated(
        $entityClass,
        array $criteria,
        $sorting = [],
        $offset = Request\Params::DEFAULT_PAGE_OFFSET,
        $limit = Request\Params::DEFAULT_PAGE_SIZE,
        $translatable = false
    )
    {
        $qb = $this->getQueryBuilder($entityClass, $criteria, $sorting, $translatable);
        
        $qb->setFirstResult($offset)
            ->setMaxResults($limit);

        $paginator = new Paginator($qb->getQuery());
        $collection = new PaginatedCollection($paginator);

        return $collection;
    }
1254543
public function findBy(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null)
    {
        return $this->findAll();
    }
1287187
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $persister = $this->entityManager->getEntityPersister($this->className);

        return $persister->loadAll($criteria, $orderBy, $limit, $offset);
    }