public function testGetData()
 {
     $resource = new Collection($this->simpleCollection, function (array $data) {
         return $data;
     });
     $this->assertEquals($resource->getData(), $this->simpleCollection);
 }
示例#2
0
 /**
  * Render json response
  *
  * @return JsonResponse
  */
 public function output()
 {
     $output = ["draw" => (int) $this->input['draw'], "recordsTotal" => $this->totalRecords, "recordsFiltered" => $this->filteredRecords];
     if (isset($this->transformer)) {
         $collection = new Collection($this->result_array_r, new $this->transformer());
         $output['data'] = $collection->getData();
     } else {
         $output['data'] = $this->result_array_r;
     }
     if ($this->isDebugging()) {
         $output = $this->showDebugger($output);
     }
     return new JsonResponse($output);
 }