FilterDefinition
in package
Represents a filter definition on a record (no acutaly filter)
Table of Contents
- VALID_OPERATORS = ['>', '<', '>=', '<=', '=', '!=', 'contains', 'startswith', 'endswith']
- VALID_TYPES = ['const', 'field']
- $field : string
- $fieldnameOrValue : string
- $operator : string
- $type : string
- __construct() : mixed
- Constructor.
- toFilter() : Filter
- Converts FilterDefinition array plus record data into ready to use array.
Constants
VALID_OPERATORS
public
mixed
VALID_OPERATORS
= ['>', '<', '>=', '<=', '=', '!=', 'contains', 'startswith', 'endswith']
VALID_TYPES
public
mixed
VALID_TYPES
= ['const', 'field']
Properties
$field
public
string
$field
= ''
The field to filter
$fieldnameOrValue
public
string
$fieldnameOrValue
= null
The value, or the reference field name
$operator
public
string
$operator
= ''
The comparison operator
$type
public
string
$type
= ''
Type of the filter ('const' or 'field')
Methods
__construct()
Constructor.
public
__construct(string $field, string $operator, string $type, string $fieldnameOrValue) : mixed
Parameters
- $field : string
-
The field to apply the filter
- $operator : string
-
['>','<','>=','<=','=','!=','contains','startswith','endswith']
- $type : string
-
['const','field']. 'const' = fixed value, 'field' = the fieldname which provides the value.
- $fieldnameOrValue : string
Return values
mixed —toFilter()
Converts FilterDefinition array plus record data into ready to use array.
public
toFilter([mixed $record = [] ]) : Filter
Parameters
- $record : mixed = []
Return values
Filter —Returns ready to use filter.