1 <?php
2 3 4 5
6
7 8 9 10 11 12 13 14
15 class StartsWithMultiFilter extends SearchFilter {
16
17 public function apply(SQLQuery $query) {
18 $query = $this->applyRelation($query);
19 $values = explode(',', $this->getValue());
20
21 foreach($values as $value) {
22 $matches[] = sprintf("%s LIKE '%s%%'",
23 $this->getDbName(),
24 Convert::raw2sql(str_replace("'", '', $value))
25 );
26 }
27
28 return $query->where(implode(" OR ", $matches));
29 }
30
31 public function isEmpty() {
32 return $this->getValue() == null || $this->getValue() == '';
33 }
34 }
35 ?>
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-