protected function findBy($entityClass, $searchQuery, array $searchableFields, $page = 1, $maxPerPage = 15, $sortField = null, $sortDirection = null, $dqlFilter = null)
    {
        if (empty($sortDirection) || !\in_array(\strtoupper($sortDirection), ['ASC', 'DESC'])) {
            $sortDirection = 'DESC';
        }

        $queryBuilder = $this->executeDynamicMethod('create<EntityName>SearchQueryBuilder', [$entityClass, $searchQuery, $searchableFields, $sortField, $sortDirection, $dqlFilter]);

        $this->dispatch(EasyAdminEvents::POST_SEARCH_QUERY_BUILDER, [
            'query_builder' => $queryBuilder,
            'search_query' => $searchQuery,
            'searchable_fields' => $searchableFields,
        ]);

        return $this->get('easyadmin.paginator')->createOrmPaginator($queryBuilder, $page, $maxPerPage);
    }
protected function findBy($entityClass, $searchQuery, array $searchableFields, $page = 1, $maxPerPage = 15, $sortField = null, $sortDirection = null, $dqlFilter = null)
    {
        if (empty($sortDirection) || !\in_array(\strtoupper($sortDirection), ['ASC', 'DESC'])) {
            $sortDirection = 'DESC';
        }

        $queryBuilder = $this->executeDynamicMethod('create<EntityName>SearchQueryBuilder', [$entityClass, $searchQuery, $searchableFields, $sortField, $sortDirection, $dqlFilter]);

        $this->dispatch(EasyAdminEvents::POST_SEARCH_QUERY_BUILDER, [
            'query_builder' => $queryBuilder,
            'search_query' => $searchQuery,
            'searchable_fields' => $searchableFields,
        ]);

        return $this->get('easyadmin.paginator')->createOrmPaginator($queryBuilder, $page, $maxPerPage);
    }
protected function findBy ( $ entityClass , $ searchQuery , array $ searchableFields , $ page = 1 , $ maxPerPage = 15 , $ sortField = null , $ sortDirection = null , $ dqlFilter = null ) { if ( empty ( $ sortDirection ) || ! \ in_array ( \ strtoupper ( $ sortDirection ) , [ 'ASC' , 'DESC' ] ) ) { $ sortDirection = 'DESC' ; } $ queryBuilder = $ this -> executeDynamicMethod ( 'create<EntityName>SearchQueryBuilder' , [ $ entityClass , $ searchQuery , $ searchableFields , $ sortField , $ sortDirection , $ dqlFilter ] ) ; $ this -> dispatch ( EasyAdminEvents :: POST_SEARCH_QUERY_BUILDER , [ 'query_builder' => $ queryBuilder , 'search_query' => $ searchQuery , 'searchable_fields' => $ searchableFields , ] ) ; return $ this -> get ( 'easyadmin.paginator' ) -> createOrmPaginator ( $ queryBuilder , $ page , $ maxPerPage ) ; }
Performs a database query based on the search query provided by the user.
It supports pagination and field sorting.

@param string      $entityClass
@param string      $searchQuery
@param array       $searchableFields
@param int         $page
@param int         $maxPerPage
@param string|null $sortField
@param string|null $sortDirection
@param string|null $dqlFilter

@return Pagerfanta The paginated query results
Performs a database query based on the search query provided by the user . It supports pagination and field sorting .