2017-04-21 03:26:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\FullTextSearch\Search\Queries;
|
|
|
|
|
2018-05-14 18:04:40 +02:00
|
|
|
use SilverStripe\Dev\Deprecation;
|
|
|
|
|
2017-04-21 03:26:24 +02:00
|
|
|
/**
|
|
|
|
* Create one of these and pass as one of the values in filter or exclude to filter or exclude by a (possibly
|
|
|
|
* open ended) range
|
|
|
|
*/
|
|
|
|
class SearchQuery_Range
|
|
|
|
{
|
|
|
|
public $start = null;
|
|
|
|
public $end = null;
|
|
|
|
|
|
|
|
public function __construct($start = null, $end = null)
|
|
|
|
{
|
|
|
|
$this->start = $start;
|
|
|
|
$this->end = $end;
|
|
|
|
}
|
|
|
|
|
2018-05-14 18:04:40 +02:00
|
|
|
public function setStart($start)
|
2017-04-21 03:26:24 +02:00
|
|
|
{
|
|
|
|
$this->start = $start;
|
2018-05-14 18:04:40 +02:00
|
|
|
return $this;
|
2017-04-21 03:26:24 +02:00
|
|
|
}
|
|
|
|
|
2018-05-14 18:04:40 +02:00
|
|
|
public function setEnd($end)
|
2017-04-21 03:26:24 +02:00
|
|
|
{
|
|
|
|
$this->end = $end;
|
2018-05-14 18:04:40 +02:00
|
|
|
return $this;
|
2017-04-21 03:26:24 +02:00
|
|
|
}
|
|
|
|
|
2018-05-14 18:04:40 +02:00
|
|
|
public function isFiltered()
|
2017-04-21 03:26:24 +02:00
|
|
|
{
|
|
|
|
return $this->start !== null || $this->end !== null;
|
|
|
|
}
|
2018-05-14 18:04:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
* @codeCoverageIgnore
|
|
|
|
*/
|
|
|
|
public function start($start)
|
|
|
|
{
|
|
|
|
Deprecation::notice('4.0', 'Use setStart() instead');
|
|
|
|
return $this->setStart($start);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
* @codeCoverageIgnore
|
|
|
|
*/
|
|
|
|
public function end($end)
|
|
|
|
{
|
|
|
|
Deprecation::notice('4.0', 'Use setEnd() instead');
|
|
|
|
return $this->setEnd($end);
|
|
|
|
}
|
2017-11-14 21:48:52 +01:00
|
|
|
}
|