OpenSkill\Datatable\Queries\Parser\Datatable110QueryParser::parse PHP 메소드

parse() 공개 메소드

Method that should parse the request and return a DTQueryConfiguration
public parse ( Request $request, array $columnConfiguration ) : OpenSkill\Datatable\Queries\QueryConfiguration
$request Symfony\Component\HttpFoundation\Request The current request that should be investigated
$columnConfiguration array The configuration of the columns
리턴 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();
    }

Usage Example

 /**
  * 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());
 }
All Usage Examples Of OpenSkill\Datatable\Queries\Parser\Datatable110QueryParser::parse