/**
  * {@inheritdoc}
  */
 public function getData(RequestInterface $request)
 {
     $offset = $request->getLimit() * ($request->getPage() - 1);
     $criteria = new Criteria();
     $criteria->setMaxResults($request->getLimit());
     $criteria->setFirstResult($offset);
     $this->processOrder($criteria, $request);
     $this->processSearch($criteria, $request);
     $this->processGlobalSearch($criteria, $request);
     $result = $this->collection->matching($criteria);
     return $this->processData($result);
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function getData(RequestInterface $request)
 {
     $data = new \SplDoublyLinkedList();
     $source = array_slice($this->source, $request->getLimit() * ($request->getPage() - 1), $request->getLimit());
     foreach ($source as $rowData) {
         $row = new Row();
         foreach ($rowData as $cellData) {
             $row->appendCell(new Cell($cellData));
         }
         $data[] = $row;
     }
     return $data;
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function getTotal()
 {
     if ($this->total === null) {
         $totalRows = $this->dataProvider->getTotal($this->request);
         if ($totalRows === 0) {
             return 0;
         }
         $limit = $this->request->getLimit();
         $this->total = $totalRows > $limit ? (int) ceil($totalRows / $limit) : 1;
     }
     return $this->total;
 }
示例#4
0
 /**
  * {@inheritdoc}
  */
 public function getLimit()
 {
     return $this->request->getLimit();
 }