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