Browse files

API CHANGE: Deprecate SubstringFilter in favour of PartialMatchFilter.

  • Loading branch information...
1 parent 9bf247c commit 5a157a6365c0441c31cc3dfdfa7e33203eb7d176 @sminnee sminnee committed Dec 17, 2011
Showing with 6 additions and 10 deletions.
  1. +6 −1 search/filters/SubstringFilter.php
  2. +0 −8 tests/model/DataListTest.php
  3. +0 −1 tests/search/SearchContextTest.php
View
7 search/filters/SubstringFilter.php
@@ -6,11 +6,16 @@
/**
* Uses a substring match against content in column rows.
+ * @deprecated Use PartialMatchFilter instead
*
* @package sapphire
* @subpackage search
*/
-class SubstringFilter extends SearchFilter {
+class SubstringFilter extends PartialMatchFilter {
+ function __construct($fullName, $value = false) {
+ Deprecation::notice('3.0', 'PartialMatchFilter instead.');
+ SearchFilter::__construct($fullName, $value);
+ }
public function apply(DataQuery $query) {
$this->model = $query->applyRelation($this->relation);
View
8 tests/model/DataListTest.php
@@ -326,14 +326,6 @@ public function testSimpleFilterStartsWith() {
$this->assertEquals('Bob', $list->first()->Name, 'First comment should be from Bob');
}
- public function testSimpleFilterSubstring() {
- $list = DataList::create("DataObjectTest_TeamComment");
- $list->filter('Comment:SubString', 'team comment');
- $this->assertEquals(2, $list->count());
- $this->assertEquals('Joe', $list->first()->Name, 'First comment should be from Bob');
- $this->assertEquals('Bob', $list->last()->Name, 'First comment should be from Bob');
- }
-
public function testSimpleFilterWithNonExistingComparisator() {
$this->setExpectedException('InvalidArgumentException');
$list = DataList::create("DataObjectTest_TeamComment");
View
1 tests/search/SearchContextTest.php
@@ -253,7 +253,6 @@ class SearchContextTest_AllFilterTypes extends DataObject implements TestOnly {
"ExactMatch" => "ExactMatchFilter",
"PartialMatch" => "PartialMatchFilter",
"Negation" => "NegationFilter",
- "SubstringMatch" => "SubstringFilter",
"CollectionMatch" => "ExactMatchMultiFilter",
"StartsWith" => "StartsWithFilter",
"EndsWith" => "EndsWithFilter",

0 comments on commit 5a157a6

Please sign in to comment.