|
<?php |
|
|
|
namespace Kanboard\Core\Filter; |
|
|
|
use PicoDb\Table; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OrCriteria implements CriteriaInterface |
|
{ |
|
|
|
|
|
|
|
protected $query; |
|
|
|
|
|
|
|
|
|
protected $filters = array(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function withQuery(Table $query) |
|
{ |
|
$this->query = $query; |
|
return $this; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function withFilter(FilterInterface $filter) |
|
{ |
|
$this->filters[] = $filter; |
|
return $this; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function apply() |
|
{ |
|
$this->query->beginOr(); |
|
|
|
foreach ($this->filters as $filter) { |
|
$filter->withQuery($this->query)->apply(); |
|
} |
|
|
|
$this->query->closeOr(); |
|
return $this; |
|
} |
|
} |
|
|