public parse ( |
||
$request | The current request that should be investigated | |
$columnConfiguration | array | The configuration of the columns |
return | OpenSkill\Datatable\Queries\QueryConfiguration | the configuration the provider can use to prepare the data |
public function parse(Request $request, array $columnConfiguration)
{
$query = $request->query;
$builder = QueryConfigurationBuilder::create();
$this->getDrawCall($query, $builder);
$this->getStart($query, $builder);
$this->getLength($query, $builder);
$this->getSearch($query, $builder);
$this->getRegex($query, $builder);
$this->getOrder($query, $builder, $columnConfiguration);
$this->getSearchColumns($query, $builder, $columnConfiguration);
return $builder->build();
}
/** * Will test that an empty search will not trigger a search. */ public function testEmptySearch() { $this->request = new Request(['draw' => 13, 'start' => 11, 'length' => 103, 'search' => ['value' => '', 'regex' => true], 'order' => [0 => ['column' => 0, 'dir' => 'asc']], 'columns' => [0 => ['search' => ['value' => '', 'regex' => true]]]]); $this->parser = new Datatable110QueryParser($this->request); $column = ColumnConfigurationBuilder::create()->name("id")->build(); $conf = $this->parser->parse($this->request, [$column]); // assert column order $this->assertFalse($conf->isGlobalSearch()); $this->assertCount(0, $conf->searchColumns()); $this->assertFalse($conf->isColumnSearch()); }