public function findByFilters($filters, $sort = [], $limit = null, $offset = null)
    {
        $queryBuilder = $this->createQueryBuilder('dynamic');

        // Add filter.
        $this->addFilter($queryBuilder, $filters);

        // Add sorting.
        if (!empty($sort)) {
            foreach ($sort as $key => $value) {
                $queryBuilder->addOrderBy('dynamic.' . $key, $value);
            }
        }

        // Add limit and offset.
        if ($limit) {
            $queryBuilder->setMaxResults($limit);
        }

        if ($offset) {
            $queryBuilder->setFirstResult($offset);
        }

        return $queryBuilder->getQuery()->getResult();
    }
public function findByFilters($filters, $sort = [], $limit = null, $offset = null)
    {
        $queryBuilder = $this->createQueryBuilder('dynamic');

        // Add filter.
        $this->addFilter($queryBuilder, $filters);

        // Add sorting.
        if (!empty($sort)) {
            foreach ($sort as $key => $value) {
                $queryBuilder->addOrderBy('dynamic.' . $key, $value);
            }
        }

        // Add limit and offset.
        if ($limit) {
            $queryBuilder->setMaxResults($limit);
        }

        if ($offset) {
            $queryBuilder->setFirstResult($offset);
        }

        return $queryBuilder->getQuery()->getResult();
    }
public function findByFilters ( $ filters , $ sort = [ ] , $ limit = null , $ offset = null ) { $ queryBuilder = $ this -> createQueryBuilder ( 'dynamic' ) ; // Add filter. $ this -> addFilter ( $ queryBuilder , $ filters ) ; // Add sorting. if ( ! empty ( $ sort ) ) { foreach ( $ sort as $ key => $ value ) { $ queryBuilder -> addOrderBy ( 'dynamic.' . $ key , $ value ) ; } } // Add limit and offset. if ( $ limit ) { $ queryBuilder -> setMaxResults ( $ limit ) ; } if ( $ offset ) { $ queryBuilder -> setFirstResult ( $ offset ) ; } return $ queryBuilder -> getQuery ( ) -> getResult ( ) ; }
Finds dynamic entries by the given parameters.

@param array $filters
@param array $sort
@param int|null $limit
@param int|null $offset

@return array
Finds dynamic entries by the given parameters .