|
@@ 457-477 (lines=21) @@
|
| 454 |
|
* @param string|array See {@link filter()} |
| 455 |
|
* @return static |
| 456 |
|
*/ |
| 457 |
|
public function filterAny() |
| 458 |
|
{ |
| 459 |
|
$numberFuncArgs = count(func_get_args()); |
| 460 |
|
$whereArguments = array(); |
| 461 |
|
|
| 462 |
|
if ($numberFuncArgs == 1 && is_array(func_get_arg(0))) { |
| 463 |
|
$whereArguments = func_get_arg(0); |
| 464 |
|
} elseif ($numberFuncArgs == 2) { |
| 465 |
|
$whereArguments[func_get_arg(0)] = func_get_arg(1); |
| 466 |
|
} else { |
| 467 |
|
throw new InvalidArgumentException('Incorrect number of arguments passed to filterAny()'); |
| 468 |
|
} |
| 469 |
|
|
| 470 |
|
return $this->alterDataQuery(function (DataQuery $query) use ($whereArguments) { |
| 471 |
|
$subquery = $query->disjunctiveGroup(); |
| 472 |
|
|
| 473 |
|
foreach ($whereArguments as $field => $value) { |
| 474 |
|
$filter = $this->createSearchFilter($field, $value); |
| 475 |
|
$filter->apply($subquery); |
| 476 |
|
} |
| 477 |
|
}); |
| 478 |
|
} |
| 479 |
|
|
| 480 |
|
/** |
|
@@ 614-634 (lines=21) @@
|
| 611 |
|
* @param string|array Escaped SQL statement. If passed as array, all keys and values will be escaped internally |
| 612 |
|
* @return $this |
| 613 |
|
*/ |
| 614 |
|
public function exclude() |
| 615 |
|
{ |
| 616 |
|
$numberFuncArgs = count(func_get_args()); |
| 617 |
|
$whereArguments = array(); |
| 618 |
|
|
| 619 |
|
if ($numberFuncArgs == 1 && is_array(func_get_arg(0))) { |
| 620 |
|
$whereArguments = func_get_arg(0); |
| 621 |
|
} elseif ($numberFuncArgs == 2) { |
| 622 |
|
$whereArguments[func_get_arg(0)] = func_get_arg(1); |
| 623 |
|
} else { |
| 624 |
|
throw new InvalidArgumentException('Incorrect number of arguments passed to exclude()'); |
| 625 |
|
} |
| 626 |
|
|
| 627 |
|
return $this->alterDataQuery(function (DataQuery $query) use ($whereArguments) { |
| 628 |
|
$subquery = $query->disjunctiveGroup(); |
| 629 |
|
|
| 630 |
|
foreach ($whereArguments as $field => $value) { |
| 631 |
|
$filter = $this->createSearchFilter($field, $value); |
| 632 |
|
$filter->exclude($subquery); |
| 633 |
|
} |
| 634 |
|
}); |
| 635 |
|
} |
| 636 |
|
|
| 637 |
|
/** |