silverstripe-framework/search/filters/SubstringFilter.php

24 lines
447 B
PHP
Raw Normal View History

<?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(SQLQuery $query) {
return $query->where("LOCATE('{$this->getValue()}', {$this->getDbName()}) != 0");
}
public function isEmpty() {
return $this->getValue() == null || $this->getValue() == '';
}
}
?>