src/Bridge/Doctrine/ORM/DataProvider/ORMDataProvider.php
public function getCollection(AdminInterface $admin, array $filters = [])
    {
        $adminConfiguration = $admin->getConfiguration();
        $actionConfiguration = $admin->getAction()->getConfiguration();

        // Create a query builder for the configured entity class
        $queryBuilder = $this
            ->getRepository($adminConfiguration->getParameter('entity'))
            ->createQueryBuilder('entity')
        ;

        // Dispatch an event to allow filter alteration on the query builder
        $event = new ORMFilterEvent($queryBuilder, $admin, $filters);
        $this->eventDispatcher->dispatch(Events::DOCTRINE_ORM_FILTER, $event);

        if ('pagerfanta' === $actionConfiguration->getParameter('pager')) {
            $pageParameter = $actionConfiguration->getParameter('page_parameter');
            $request = $this->requestStack->getCurrentRequest();
            $page = (int) $request->get($pageParameter, 1);

            $adapter = new DoctrineORMAdapter($queryBuilder);
            $pager = new Pagerfanta($adapter);
            $pager->setCurrentPage($page);
            $pager->setMaxPerPage($actionConfiguration->getParameter('max_per_page'));
            $entities = $pager;
        } else {
            $entities = $queryBuilder->getQuery()->getResult();
        }

        return $entities;
    }
public function getCollection(AdminInterface $admin, array $filters = [])
    {
        $adminConfiguration = $admin->getConfiguration();
        $actionConfiguration = $admin->getAction()->getConfiguration();

        // Create a query builder for the configured entity class
        $queryBuilder = $this
            ->getRepository($adminConfiguration->getParameter('entity'))
            ->createQueryBuilder('entity')
        ;

        // Dispatch an event to allow filter alteration on the query builder
        $event = new ORMFilterEvent($queryBuilder, $admin, $filters);
        $this->eventDispatcher->dispatch(Events::DOCTRINE_ORM_FILTER, $event);

        if ('pagerfanta' === $actionConfiguration->getParameter('pager')) {
            $pageParameter = $actionConfiguration->getParameter('page_parameter');
            $request = $this->requestStack->getCurrentRequest();
            $page = (int) $request->get($pageParameter, 1);

            $adapter = new DoctrineORMAdapter($queryBuilder);
            $pager = new Pagerfanta($adapter);
            $pager->setCurrentPage($page);
            $pager->setMaxPerPage($actionConfiguration->getParameter('max_per_page'));
            $entities = $pager;
        } else {
            $entities = $queryBuilder->getQuery()->getResult();
        }

        return $entities;
    }
public function getCollection ( AdminInterface $ admin , array $ filters = [ ] ) { $ adminConfiguration = $ admin -> getConfiguration ( ) ; $ actionConfiguration = $ admin -> getAction ( ) -> getConfiguration ( ) ; // Create a query builder for the configured entity class $ queryBuilder = $ this -> getRepository ( $ adminConfiguration -> getParameter ( 'entity' ) ) -> createQueryBuilder ( 'entity' ) ; // Dispatch an event to allow filter alteration on the query builder $ event = new ORMFilterEvent ( $ queryBuilder , $ admin , $ filters ) ; $ this -> eventDispatcher -> dispatch ( Events :: DOCTRINE_ORM_FILTER , $ event ) ; if ( 'pagerfanta' === $ actionConfiguration -> getParameter ( 'pager' ) ) { $ pageParameter = $ actionConfiguration -> getParameter ( 'page_parameter' ) ; $ request = $ this -> requestStack -> getCurrentRequest ( ) ; $ page = ( int ) $ request -> get ( $ pageParameter , 1 ) ; $ adapter = new DoctrineORMAdapter ( $ queryBuilder ) ; $ pager = new Pagerfanta ( $ adapter ) ; $ pager -> setCurrentPage ( $ page ) ; $ pager -> setMaxPerPage ( $ actionConfiguration -> getParameter ( 'max_per_page' ) ) ; $ entities = $ pager ; } else { $ entities = $ queryBuilder -> getQuery ( ) -> getResult ( ) ; } return $ entities ; }
Load a collection of entities.

@param AdminInterface $admin
@param array          $filters

@return mixed
Load a collection of entities .