Skip to content

Commit bfba4be

Browse files
authored
Update QueryObjectDataSource.php
1 parent 312d2d9 commit bfba4be

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

src/QueryObjectDataSource.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,26 +135,23 @@ public function setData($data) {
135135
* @param array $filters
136136
* @return static
137137
*/
138-
public function filter(array $filters): void {
139-
foreach ($filters as $filter) {
140-
if ($filter->isValueSet()) {
141-
if ($filter->getConditionCallback()) {
142-
call_user_func($filter->getConditionCallback(), $this->queryObject, $filter->getValue());
143-
} else {
144-
if ($this->queryObject instanceof IQueryObject) {
145-
if ($filter instanceof FilterText) {
146-
$this->queryObject->searchIn($filter->getKey(), $filter->getValue());
147-
} else {
148-
$this->queryObject->equalIn($filter->getKey(), $filter->getValue());
149-
}
138+
public function filter(array $filters): void
139+
{
140+
if (is_callable($this->filterCallback)) {
141+
call_user_func($this->filterCallback, $this->queryObject, $filters);
142+
}
143+
else {
144+
foreach ($filters as $filter) {
145+
if ($filter->isValueSet()) {
146+
if ($filter->getConditionCallback()) {
147+
call_user_func($filter->getConditionCallback(), $this->queryObject, $filter->getValue());
148+
}
149+
elseif ($this->queryObject instanceof IQueryObject) {
150+
$this->queryObject->searchIn($filter->getKey(), $filter->getValue(), !$filter instanceof FilterText);
150151
}
151152
}
152153
}
153154
}
154-
155-
if (is_callable($this->filterCallback)) {
156-
call_user_func_array($this->filterCallback, [$this->queryObject, $filters]);
157-
}
158155
}
159156

160157
/**

0 commit comments

Comments
 (0)