mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-08-02 08:45:39 +02:00
28 lines
493 B
PHP
28 lines
493 B
PHP
<?php
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage search
|
|
*/
|
|
|
|
/**
|
|
* Uses a substring match against content in column rows.
|
|
*
|
|
* @package sapphire
|
|
* @subpackage search
|
|
*/
|
|
class SubstringFilter extends SearchFilter {
|
|
|
|
public function apply(DataQuery $query) {
|
|
return $query->filter(sprintf(
|
|
"LOCATE('%s', %s) != 0",
|
|
Convert::raw2sql($this->getValue()),
|
|
$this->getDbName()
|
|
));
|
|
}
|
|
|
|
public function isEmpty() {
|
|
return $this->getValue() == null || $this->getValue() == '';
|
|
}
|
|
}
|
|
|
|
?>
|