2008-08-09 08:40:50 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage search
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Matches textual content with a substring match on a text fragment leading
|
|
|
|
* to the end of the string.
|
|
|
|
*
|
|
|
|
* <code>
|
|
|
|
* "abcdefg" => "defg" # true
|
|
|
|
* "abcdefg" => "abcd" # false
|
|
|
|
* </code>
|
|
|
|
*
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage search
|
|
|
|
*/
|
|
|
|
class EndsWithFilter extends SearchFilter {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Applies a match on the trailing characters of a field value.
|
|
|
|
*
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2011-03-21 09:37:55 +01:00
|
|
|
public function apply(DataQuery $query) {
|
|
|
|
$this->model = $query->applyRelation($this->relation);
|
2011-04-05 13:01:57 +02:00
|
|
|
$query->where($this->getDbName() . " LIKE '%" . Convert::raw2sql($this->getValue()) . "'");
|
2008-08-09 08:40:50 +02:00
|
|
|
}
|
|
|
|
|
2008-08-11 02:03:57 +02:00
|
|
|
public function isEmpty() {
|
|
|
|
return $this->getValue() == null || $this->getValue() == '';
|
|
|
|
}
|
2008-08-09 08:40:50 +02:00
|
|
|
}
|