chg: [CRUD] Also harvest negated filters from URL

pull/40/head
mokaddem 2021-03-10 09:35:26 +01:00
parent ddccb758b8
commit 67d6683ed8
1 changed files with 6 additions and 1 deletions

View File

@ -31,7 +31,12 @@ class CRUDComponent extends Component
$options['filters'][] = 'quickFilter';
}
$options['filters'][] = 'filteringLabel';
$params = $this->Controller->ParamHandler->harvestParams(empty($options['filters']) ? [] : $options['filters']);
$optionFilters = empty($options['filters']) ? [] : $options['filters'];
foreach ($optionFilters as $i => $filter) {
$optionFilters[] = "{$filter} !=";
}
$params = $this->Controller->ParamHandler->harvestParams($optionFilters);
$query = $this->Table->find();
$query = $this->setFilters($params, $query, $options);
$query = $this->setQuickFilters($params, $query, empty($options['quickFilters']) ? [] : $options['quickFilters']);