Beispiel #1
0
 /**
  * Returns fetched data.
  * @param bool $applyPaging
  * @param bool $useCache
  * @throws \Exception
  * @return array
  */
 public function getData($applyPaging = TRUE, $useCache = TRUE)
 {
     if ($this->model === NULL) {
         throw new \Exception('Model cannot be empty, please use method $grid->setModel().');
     }
     $data = $this->data;
     if ($data === NULL || $useCache === FALSE) {
         $this->applyFiltering();
         $this->applySorting();
         if ($applyPaging) {
             $this->applyPaging();
         }
         $data = $this->model->getData();
         if ($useCache === TRUE) {
             $this->data = $data;
         }
         if ($applyPaging && $data && !in_array($this->page, range(1, $this->getPaginator()->pageCount))) {
             trigger_error("Page is out of range.", E_USER_NOTICE);
             $this->page = 1;
         }
         if ($this->onFetchData) {
             $this->onFetchData($this);
         }
     }
     return $data;
 }
 public function getData()
 {
     return $this->dataSource->getData();
 }