mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-08 02:31:35 +02:00
34 lines
768 B
PHP
Executable File
34 lines
768 B
PHP
Executable File
<?php
|
|
/**
|
|
* @package framework
|
|
* @subpackage search
|
|
*/
|
|
|
|
/**
|
|
* Uses a substring match against content in column rows.
|
|
* @deprecated 3.0 Use PartialMatchFilter instead
|
|
*
|
|
* @package framework
|
|
* @subpackage search
|
|
*/
|
|
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);
|
|
return $query->where(sprintf(
|
|
"LOCATE('%s', %s) != 0",
|
|
Convert::raw2sql($this->getValue()),
|
|
$this->getDbName()
|
|
));
|
|
}
|
|
|
|
public function isEmpty() {
|
|
return $this->getValue() == null || $this->getValue() == '';
|
|
}
|
|
}
|
|
|