protected function DataProviderDbQuery::queryForListFilter in RESTful 7.2
Filter the query for list.
Parameters
\SelectQuery $query: The query object.
Throws
See also
\RestfulEntityBase::getQueryForList
1 call to DataProviderDbQuery::queryForListFilter()
- DataProviderDbQuery::getQueryForList in src/
Plugin/ resource/ DataProvider/ DataProviderDbQuery.php
File
- src/
Plugin/ resource/ DataProvider/ DataProviderDbQuery.php, line 432 - Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderDbQuery.
Class
Namespace
Drupal\restful\Plugin\resource\DataProviderCode
protected function queryForListFilter(\SelectQuery $query) {
foreach ($this
->parseRequestForListFilter() as $filter) {
/* @var ResourceFieldDbColumnInterface $filter_field */
if (!($filter_field = $this->fieldDefinitions
->get($filter['public_field']))) {
continue;
}
$column_name = $filter_field
->getColumnForQuery();
if (in_array(strtoupper($filter['operator'][0]), array(
'IN',
'NOT IN',
'BETWEEN',
))) {
$query
->condition($column_name, $filter['value'], $filter['operator'][0]);
continue;
}
$condition = db_condition($filter['conjunction']);
for ($index = 0; $index < count($filter['value']); $index++) {
$condition
->condition($column_name, $filter['value'][$index], $filter['operator'][$index]);
}
$query
->condition($condition);
}
}