mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE: Deprecate SubstringFilter in favour of PartialMatchFilter.
This commit is contained in:
parent
9bf247cc33
commit
5a157a6365
@ -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);
|
||||
|
@ -326,14 +326,6 @@ class DataListTest extends SapphireTest {
|
||||
$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");
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user