/**
  * Contains common output behavior here based on columns definitions.
  *
  * @param $row
  * @param AbstractTable $table
  *
  * @return mixed
  */
 public function formatRow($row, AbstractTable $table)
 {
     $cols = $table->getColumns();
     $newRow = [];
     foreach ($cols as $colIdentifier => $column) {
         $rawValue = array_key_exists($colIdentifier, $row) ? $row[$colIdentifier] : "";
         if ($column->getOptions()['auto_escape']) {
             $value = htmlentities($rawValue, ENT_COMPAT | ENT_HTML401, 'UTF-8');
         } else {
             $value = $rawValue;
         }
         $colVal = $column->formatCell($value, $row);
         //Column definition
         $newRow[$colIdentifier] = $colVal;
     }
     return $newRow;
 }
 public static function fromHttpRequest(Request $request, AbstractTable $table)
 {
     $table->getFilterForm()->handleRequest($request);
     $numericOrder = $request->get('order', []);
     $colnameOrder = [];
     //Limit: support single column ordering
     if (!empty($numericOrder[0]) && !empty($numericOrder[0]['column'])) {
         $colIndex = 0;
         $sortColIndex = $numericOrder[0]['column'];
         foreach ($table->getColumns() as $colid => $column) {
             if ($sortColIndex == $colIndex) {
                 $colnameOrder[$colid] = $numericOrder[0]['dir'];
             }
             $colIndex++;
         }
     }
     return new static($request->get('start', 0), $request->get('length', 10), $request->get('search', []), $table->getFilterForm(), $request->get('columns', []), $colnameOrder);
 }