PHP Class FOF30\Model\DataModel\Filter\AbstractFilter

Mostra file Open project: akeeba/fof Class Usage Examples

Public Properties

Property Type Description
$null_value mixed The null value for this type

Protected Properties

Property Type Description
$db
$filterZero boolean Should I allow filtering against the number 0?
$name string The column name of the table field
$tableAlias null Prefix each table name with this table alias. For example, field bar normally creates a WHERE clause: bar = '1' If tableAlias is set to "foo" then the WHERE clause it generates becomes foo.bar = '1'
$type string The column type of the table field

Public Methods

Method Description
__construct ( JDatabaseDriver $db, object $field ) Constructor
between ( mixed $from, mixed $to, boolean $include = true ) : string Perform a between limits match (usually: search for a value between two numbers or a date between two preset dates). When $include is true the condition tested is: $from <= VALUE <= $to When $include is false the condition tested is: $from < VALUE < $to
exact ( mixed $value ) : string Perform an exact match (equality matching)
getDefaultSearchMethod ( ) : string Returns the default search method for a field. This always returns 'exact' and you are supposed to override it in specialised classes. The possible values are exact, partial, between and outside, unless something different is returned by getSearchMethods().
getField ( object $field, array $config = [] ) : AbstractFilter Creates a field Object based on the field column type
getFieldName ( ) : string Get the field name
getFieldType ( string $type ) : string Get the class name based on the field Type
getSearchMethods ( ) : array Return the search methods available for this field class,
interval ( string $from, string | array | object $interval ) : string Perform an interval search (usually: a date interval check)
isEmpty ( mixed $value ) : boolean Is it a null or otherwise empty value?
modulo ( integer | float $from, integer | float $interval, boolean $include = true ) : string Perform an modulo search
outside ( mixed $from, mixed $to, boolean $include = false ) : string Perform an outside limits match (usually: search for a value outside an area or a date outside a preset period). When $include is true the condition tested is: (VALUE <= $from) || (VALUE >= $to) When $include is false the condition tested is: (VALUE < $from) || (VALUE > $to)
partial ( mixed $value ) : string Perform a partial match (usually: search in string)
range ( mixed $from, mixed $to, boolean $include = true ) : string Perform a between limits match (usually: search for a value between two numbers or a date between two preset dates). When $include is true the condition tested is: $from <= VALUE <= $to When $include is false the condition tested is: $from < VALUE < $to
search ( mixed $value, string $operator = '=' ) : string Return the SQL where clause for a search

Method Details

__construct() public method

Constructor
public __construct ( JDatabaseDriver $db, object $field )
$db JDatabaseDriver The database object
$field object The field information as taken from the db

between() abstract public method

Perform a between limits match (usually: search for a value between two numbers or a date between two preset dates). When $include is true the condition tested is: $from <= VALUE <= $to When $include is false the condition tested is: $from < VALUE < $to
abstract public between ( mixed $from, mixed $to, boolean $include = true ) : string
$from mixed The lowest value to compare to
$to mixed The higherst value to compare to
$include boolean Should we include the boundaries in the search?
return string The SQL where clause for this search

exact() public method

Perform an exact match (equality matching)
public exact ( mixed $value ) : string
$value mixed The value to compare to
return string The SQL where clause for this search

getDefaultSearchMethod() public method

Returns the default search method for a field. This always returns 'exact' and you are supposed to override it in specialised classes. The possible values are exact, partial, between and outside, unless something different is returned by getSearchMethods().
See also: self::getSearchMethods()
public getDefaultSearchMethod ( ) : string
return string

getField() public static method

Creates a field Object based on the field column type
public static getField ( object $field, array $config = [] ) : AbstractFilter
$field object The field informations
$config array The field configuration (like the db object to use)
return AbstractFilter The Filter object

getFieldName() public method

Get the field name
public getFieldName ( ) : string
return string The field name

getFieldType() public static method

Get the class name based on the field Type
public static getFieldType ( string $type ) : string
$type string The type of the field
return string the class name suffix

getSearchMethods() public method

Return the search methods available for this field class,
public getSearchMethods ( ) : array
return array

interval() abstract public method

Perform an interval search (usually: a date interval check)
abstract public interval ( string $from, string | array | object $interval ) : string
$from string The value to search
$interval string | array | object The interval
return string The SQL where clause for this search

isEmpty() public method

Is it a null or otherwise empty value?
public isEmpty ( mixed $value ) : boolean
$value mixed The value to test for emptiness
return boolean

modulo() abstract public method

Perform an modulo search
abstract public modulo ( integer | float $from, integer | float $interval, boolean $include = true ) : string
$from integer | float The starting value of the search space
$interval integer | float The interval period of the search space
$include boolean Should I include the boundaries in the search?
return string The SQL where clause

outside() abstract public method

Perform an outside limits match (usually: search for a value outside an area or a date outside a preset period). When $include is true the condition tested is: (VALUE <= $from) || (VALUE >= $to) When $include is false the condition tested is: (VALUE < $from) || (VALUE > $to)
abstract public outside ( mixed $from, mixed $to, boolean $include = false ) : string
$from mixed The lowest value of the excluded range
$to mixed The highest value of the excluded range
$include boolean Should we include the boundaries in the search?
return string The SQL where clause for this search

partial() abstract public method

Perform a partial match (usually: search in string)
abstract public partial ( mixed $value ) : string
$value mixed The value to compare to
return string The SQL where clause for this search

range() abstract public method

Perform a between limits match (usually: search for a value between two numbers or a date between two preset dates). When $include is true the condition tested is: $from <= VALUE <= $to When $include is false the condition tested is: $from < VALUE < $to
abstract public range ( mixed $from, mixed $to, boolean $include = true ) : string
$from mixed The lowest value to compare to
$to mixed The higherst value to compare to
$include boolean Should we include the boundaries in the search?
return string The SQL where clause for this search

Property Details

$db protected_oe property

protected $db

$filterZero protected_oe property

Should I allow filtering against the number 0?
protected bool $filterZero
return boolean

$name protected_oe property

The column name of the table field
protected string $name
return string

$null_value public_oe property

The null value for this type
public mixed $null_value
return mixed

$tableAlias protected_oe property

Prefix each table name with this table alias. For example, field bar normally creates a WHERE clause: bar = '1' If tableAlias is set to "foo" then the WHERE clause it generates becomes foo.bar = '1'
protected null $tableAlias
return null

$type protected_oe property

The column type of the table field
protected string $type
return string