AdminBundle/Service/DataTables/JsonList.php
public function get()
    {
        $totalEntities = $this->repository->countTotal();

       
        if(!is_null($this->category)){
            $entities = $this->repository->findAllForDataTablesByCategory($this->search, $this->sortColumn, $this->sortDirection, $this->category);
        }elseif(!is_null($this->entityId)){
            $entities = $this->repository->findAllForDataTables($this->search, $this->sortColumn, $this->sortDirection, $this->entityId, $this->locale);
        }elseif(!is_null($this->agreementId)){
            $entities = $this->repository->findByAgreementForDataTables($this->search, $this->sortColumn, $this->sortDirection, $this->agreementId);
        }elseif(!is_null($this->advertId)){
            $entities = $this->repository->findByAdvertForDataTables($this->search, $this->sortColumn, $this->sortDirection, $this->advertId);
        }else{
            $entities = $this->repository->findAllForDataTables($this->search, $this->sortColumn, $this->sortDirection, null, $this->locale);
        }
         
        $totalFilteredEntities = count($entities->getScalarResult());

        // paginate
        $entities->setFirstResult($this->offset)
            ->setMaxResults($this->limit);

        $data = $entities->getResult();


        return array(
            'iTotalRecords'         => $totalEntities,
            'iTotalDisplayRecords'  => $totalFilteredEntities,
            'sEcho'                 => $this->echo,
            'aaData'                => $data
        );
    }
public function get()
    {
        $totalEntities = $this->repository->countTotal();

       
        if(!is_null($this->category)){
            $entities = $this->repository->findAllForDataTablesByCategory($this->search, $this->sortColumn, $this->sortDirection, $this->category);
        }elseif(!is_null($this->entityId)){
            $entities = $this->repository->findAllForDataTables($this->search, $this->sortColumn, $this->sortDirection, $this->entityId, $this->locale);
        }elseif(!is_null($this->agreementId)){
            $entities = $this->repository->findByAgreementForDataTables($this->search, $this->sortColumn, $this->sortDirection, $this->agreementId);
        }elseif(!is_null($this->advertId)){
            $entities = $this->repository->findByAdvertForDataTables($this->search, $this->sortColumn, $this->sortDirection, $this->advertId);
        }else{
            $entities = $this->repository->findAllForDataTables($this->search, $this->sortColumn, $this->sortDirection, null, $this->locale);
        }
         
        $totalFilteredEntities = count($entities->getScalarResult());

        // paginate
        $entities->setFirstResult($this->offset)
            ->setMaxResults($this->limit);

        $data = $entities->getResult();


        return array(
            'iTotalRecords'         => $totalEntities,
            'iTotalDisplayRecords'  => $totalFilteredEntities,
            'sEcho'                 => $this->echo,
            'aaData'                => $data
        );
    }
public function get ( ) { $ totalEntities = $ this -> repository -> countTotal ( ) ; if ( ! is_null ( $ this -> category ) ) { $ entities = $ this -> repository -> findAllForDataTablesByCategory ( $ this -> search , $ this -> sortColumn , $ this -> sortDirection , $ this -> category ) ; } elseif ( ! is_null ( $ this -> entityId ) ) { $ entities = $ this -> repository -> findAllForDataTables ( $ this -> search , $ this -> sortColumn , $ this -> sortDirection , $ this -> entityId , $ this -> locale ) ; } elseif ( ! is_null ( $ this -> agreementId ) ) { $ entities = $ this -> repository -> findByAgreementForDataTables ( $ this -> search , $ this -> sortColumn , $ this -> sortDirection , $ this -> agreementId ) ; } elseif ( ! is_null ( $ this -> advertId ) ) { $ entities = $ this -> repository -> findByAdvertForDataTables ( $ this -> search , $ this -> sortColumn , $ this -> sortDirection , $ this -> advertId ) ; } else { $ entities = $ this -> repository -> findAllForDataTables ( $ this -> search , $ this -> sortColumn , $ this -> sortDirection , null , $ this -> locale ) ; } $ totalFilteredEntities = count ( $ entities -> getScalarResult ( ) ) ; // paginate $ entities -> setFirstResult ( $ this -> offset ) -> setMaxResults ( $ this -> limit ) ; $ data = $ entities -> getResult ( ) ; return array ( 'iTotalRecords' => $ totalEntities , 'iTotalDisplayRecords' => $ totalFilteredEntities , 'sEcho' => $ this -> echo , 'aaData' => $ data ) ; }
Get the list

@return array
Get the list