Ejemplo n.º 1
0
 public function testResponseDataCustomFilteredLength()
 {
     $rp = new ResponseData(new Collection([]), 456, 123);
     $this->assertSame(456, $rp->totalDataCount());
     $this->assertSame(123, $rp->filteredDataCount());
     $this->assertEquals(new Collection([]), $rp->data());
 }
 /**
  * Is responsible to take the generated data and prepare a response for it.
  * @param ResponseData $data The processed data.
  * @param QueryConfiguration $queryConfiguration the query configuration for the current request.
  * @param array $columnConfiguration the column configurations for the current data table.
  * @return JsonResponse the response that should be returned to the client.
  */
 public function createResponse(ResponseData $data, QueryConfiguration $queryConfiguration, array $columnConfiguration)
 {
     // TODO: Implement createResponse() method.
     // will generate the response according to: http://legacy.datatables.net/usage/server-side
     $responseData = ['sEcho' => $queryConfiguration->drawCall(), 'iTotalRecords' => $data->totalDataCount(), 'iTotalDisplayRecords' => $data->data()->count(), 'aaData' => $data->data()->toArray()];
     return new JsonResponse($responseData);
 }
Ejemplo n.º 3
0
 /**
  * Is responsible to take the generated data and prepare a response for it.
  * @param ResponseData $data The processed data.
  * @param QueryConfiguration $queryConfiguration the query configuration for the current request.
  * @param ColumnConfiguration[] $columnConfigurations the column configurations for the current data table.
  * @return JsonResponse the response that should be returned to the client.
  */
 public function createResponse(ResponseData $data, QueryConfiguration $queryConfiguration, array $columnConfigurations)
 {
     $responseData = ['sEcho' => $queryConfiguration->drawCall(), 'iTotalRecords' => $data->totalDataCount(), 'iTotalDisplayRecords' => $data->filteredDataCount(), 'aaData' => $data->data()->toArray()];
     return new JsonResponse($responseData);
 }
Ejemplo n.º 4
0
 public function testResponseDataCreation()
 {
     $rp = new ResponseData(new Collection([]), 123);
     $this->assertSame(123, $rp->totalDataCount());
     $this->assertEquals(new Collection([]), $rp->data());
 }
Ejemplo n.º 5
0
 /**
  * Is responsible to take the generated data and prepare a response for it.
  * @param ResponseData $data The processed data.
  * @param QueryConfiguration $queryConfiguration the query configuration for the current request.
  * @param ColumnConfiguration[] $columnConfigurations the column configurations for the current data table.
  * @return JsonResponse the response that should be returned to the client.
  */
 public function createResponse(ResponseData $data, QueryConfiguration $queryConfiguration, array $columnConfigurations)
 {
     $responseData = ['draw' => $queryConfiguration->drawCall(), 'recordsTotal' => $data->totalDataCount(), 'recordsFiltered' => $data->filteredDataCount(), 'data' => $data->data()->toArray()];
     return new JsonResponse($responseData);
 }