2008-08-09 06:38:44 +02:00
|
|
|
<?php
|
2008-08-09 08:40:50 +02:00
|
|
|
/**
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2008-08-09 08:40:50 +02:00
|
|
|
* @subpackage search
|
|
|
|
*/
|
|
|
|
|
2008-08-09 06:38:44 +02:00
|
|
|
/**
|
|
|
|
* Uses a substring match against content in column rows.
|
2012-03-09 21:34:05 +01:00
|
|
|
* @deprecated 3.0 Use PartialMatchFilter instead
|
2008-08-09 06:38:44 +02:00
|
|
|
*
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2008-08-09 06:38:44 +02:00
|
|
|
* @subpackage search
|
|
|
|
*/
|
2011-12-17 04:29:02 +01:00
|
|
|
class SubstringFilter extends PartialMatchFilter {
|
2012-09-19 12:07:39 +02:00
|
|
|
public function __construct($fullName, $value = false) {
|
2011-12-17 04:29:02 +01:00
|
|
|
Deprecation::notice('3.0', 'PartialMatchFilter instead.');
|
|
|
|
SearchFilter::__construct($fullName, $value);
|
|
|
|
}
|
2008-08-09 06:38:44 +02:00
|
|
|
|
2011-03-21 09:37:55 +01:00
|
|
|
public function apply(DataQuery $query) {
|
2011-12-09 12:49:24 +01:00
|
|
|
$this->model = $query->applyRelation($this->relation);
|
2011-04-05 13:01:57 +02:00
|
|
|
return $query->where(sprintf(
|
2008-10-05 21:20:35 +02:00
|
|
|
"LOCATE('%s', %s) != 0",
|
|
|
|
Convert::raw2sql($this->getValue()),
|
|
|
|
$this->getDbName()
|
|
|
|
));
|
2008-08-09 06:38:44 +02:00
|
|
|
}
|
2008-08-11 02:03:57 +02:00
|
|
|
|
|
|
|
public function isEmpty() {
|
|
|
|
return $this->getValue() == null || $this->getValue() == '';
|
|
|
|
}
|
2008-08-09 06:38:44 +02:00
|
|
|
}
|
|
|
|
|