mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-17 23:16:04 +02:00
d370423825
All sapphire but the lang directory
40 lines
551 B
PHP
40 lines
551 B
PHP
<?php
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage search
|
|
*/
|
|
|
|
/**
|
|
* Incomplete.
|
|
*
|
|
* @todo add to tests
|
|
*
|
|
* @package sapphire
|
|
* @subpackage search
|
|
*/
|
|
class WithinRangeFilter extends SearchFilter {
|
|
|
|
private $min;
|
|
private $max;
|
|
|
|
function setMin($min) {
|
|
$this->min = $min;
|
|
}
|
|
|
|
function setMax($max) {
|
|
$this->max = $max;
|
|
}
|
|
|
|
function apply(DataQuery $query) {
|
|
$query->where(sprintf(
|
|
"%s >= %s AND %s <= %s",
|
|
$this->getDbName(),
|
|
Convert::raw2sql($this->min),
|
|
$this->getDbName(),
|
|
Convert::raw2sql($this->max)
|
|
));
|
|
}
|
|
|
|
}
|
|
|