예제 #1
0
 /**
  * @dataProvider applyProvider
  *
  * @param array $inputData
  * @param array $expectedData
  */
 public function testApply(array $inputData, array $expectedData)
 {
     $ds = $this->prepareDatasource();
     $this->filter->apply($ds, $inputData['data']);
     $where = $this->parseQueryCondition($ds);
     $this->assertEquals($expectedData['where'], $where);
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function apply(FilterDatasourceAdapterInterface $ds, $data)
 {
     if (!$this->isApplicable($data)) {
         return parent::apply($ds, $data);
     }
     if (false === ($data = $this->parseData($data))) {
         return false;
     }
     $type = $data['type'];
     $this->applyFilterToClause($ds, $this->buildRangeComparisonExpr($ds, $type, $this->get(FilterUtility::DATA_NAME_KEY), $data['value'], $data['value_end']));
     return true;
 }