FilterDateRange
extends SearchFilter
in package
Class FilterDateRange
Provides filters for dates and timestamps as dates
Table of Contents
- $as_timestamp : bool
- $empty : bool
- Allow empty
- $field : mixed
- $field_from : string|null
- $field_to : string|null
- $is_or : bool
- Is or filter
- $value : mixed
- $value_from : int|string|null
- $value_to : int|string|null
- __construct() : mixed
- Filter Date Range constructor.
- Field() : mixed
- Get the filed
- IsOr() : bool
- Is or connection?
- ToQuery() : string
- Create query
- ToSqlQuery() : SqlTerm|array<string|int, SqlTerm>|null
- Create a sql query based on this filter
Properties
$as_timestamp
protected
bool
$as_timestamp
$empty
Allow empty
protected
bool
$empty
= false
$field
protected
mixed
$field
$field_from
protected
string|null
$field_from
= null
$field_to
protected
string|null
$field_to
= null
$is_or
Is or filter
protected
bool
$is_or
= false
$value
protected
mixed
$value
$value_from
protected
int|string|null
$value_from
= null
$value_to
protected
int|string|null
$value_to
= null
Methods
__construct()
Filter Date Range constructor.
public
__construct(string $field_from, string|null $field_to, string|null $value_from, string|null $value_to[, bool $is_or = false ][, bool $as_timestamp = false ]) : mixed
Create a date range filter, at least one of the dates must be filled
Parameters
- $field_from : string
-
The start date field name
- $field_to : string|null
-
The end date field name
- $value_from : string|null
-
The date start value in format parsable by strtotime()
- $value_to : string|null
-
The end start value in format parsable by strtotime()
- $is_or : bool = false
-
Merge with other filters with or
- $as_timestamp : bool = false
-
Use values without conversion to compare
Return values
mixed —Field()
Get the filed
public
Field() : mixed
Return values
mixed —IsOr()
Is or connection?
public
IsOr() : bool
When merged with other filter use OR instead of AND
Return values
bool —Is or merge
ToQuery()
Create query
public
ToQuery() : string
Convert to solr search query like datefrom:[2012-05-06T14:05:00Z TO ] AND dateto:[ TO 2015-07-06T03:05:00Z]
Return values
string —The search query
ToSqlQuery()
Create a sql query based on this filter
public
ToSqlQuery() : SqlTerm|array<string|int, SqlTerm>|null