Skip to content
This repository
Browse code

BUGFIX Allow PartialMatchFilter to use an array as search term

  • Loading branch information...
commit 5d7aa8f35a96ae85c86996f20edb2a7f3c7f4dac 1 parent abfa16f
Stig Lindqvist authored February 15, 2012

Showing 1 changed file with 11 additions and 5 deletions. Show diff stats Hide diff stats

  1. 16  search/filters/PartialMatchFilter.php
16  search/filters/PartialMatchFilter.php
@@ -14,11 +14,17 @@ class PartialMatchFilter extends SearchFilter {
14 14
 	
15 15
 	public function apply(DataQuery $query) {
16 16
 		$this->model = $query->applyRelation($this->relation);
17  
-		return $query->where(sprintf(
18  
-			"%s LIKE '%%%s%%'",
19  
-			$this->getDbName(),
20  
-			Convert::raw2sql($this->getValue())
21  
-		));
  17
+		$where = array();
  18
+		if(is_array($this->getValue())) {
  19
+			foreach($this->getValue() as $value) {
  20
+				$where[]= sprintf("%s LIKE '%%%s%%'", $this->getDbName(), Convert::raw2sql($value));
  21
+			}
  22
+
  23
+		} else {
  24
+			$where[] = sprintf("%s LIKE '%%%s%%'", $this->getDbName(), Convert::raw2sql($this->getValue()));
  25
+		}
  26
+
  27
+		return $query->where(implode(' OR ', $where));
22 28
 	}
23 29
 	
24 30
 	public function isEmpty() {

0 notes on commit 5d7aa8f

Please sign in to comment.
Something went wrong with that request. Please try again.