/** * @param DatatableInterface $datatable * @return Response */ public function getData(DatatableInterface $datatable) { if (!$this->isBuilt()) { $this->build($datatable); } $request = new Request($this->columns); list($data, $total, $totalDisplay) = $datatable->getData($request); $response = new Response($request->getIndex(), array(), $total, $totalDisplay); foreach ($data as $item) { $row = new Row(); /** @var Column $column */ foreach ($this->columns as $column) { $callback = $column->getData(); $row->addData($column->getName(), $callback($item)); } $datatable->rowProcess($row, $item); $response->addData($row); } return $response; }