DataBaseWhere
in package
Usar FacturaScripts\Core\Where en su lugar.
Attributes
- #[Deprecated]
- $reason: 'Use FacturaScripts\Core\Where instead'
Table of Contents
Properties
- $fields : string
- Field list to apply the filters to, separated by '|'.
- $operation : string
- Logic operator that will be applied to the condition.
- $operator : string
- Arithmetic operator that is being used.
- $useField : bool
- Allow field transformation with field: prefix.
- $value : mixed
- Filter value.
- $dataBase : DataBase
- Link with the active database.
Methods
- __construct() : mixed
- DataBaseWhere constructor.
- applyOperation() : array<string|int, mixed>
- Given a list of fields with operators: '|' for OR operations ',' for AND operations Returns an array with the field (key) and the operation (value).
- getFieldsFilter() : array<string|int, mixed>
- Given a DataBaseWhere array, it returns the field list with their values that will be applied as a filter. (It only returns filters with the '=' operator).
- getSQLWhere() : string
- Given a DataBaseWhere array, it returns the full WHERE clause.
- getSQLWhereItem() : string
- Returns a string to apply to the WHERE clause.
- applyValueToFields() : string
- Apply one value to a field list.
- escapeColumn() : string
- getGroupPrefix() : string
- Calculate if you need grouping of conditions.
- getValue() : string
- Returns the filter value formatted according to the type.
- getValueFromOperator() : string
- Returns the value for the operator.
- getValueFromOperatorIn() : string
- Return list values for IN operator.
- getValueFromOperatorLike() : string
- Return value for LIKE operator.
Properties
$fields
Field list to apply the filters to, separated by '|'.
public
string
$fields
$operation
Logic operator that will be applied to the condition.
public
string
$operation
$operator
Arithmetic operator that is being used.
public
string
$operator
$useField
Allow field transformation with field: prefix.
public
bool
$useField
$value
Filter value.
public
mixed
$value
$dataBase
Link with the active database.
private
DataBase
$dataBase
Methods
__construct()
DataBaseWhere constructor.
public
__construct(string $fields, mixed $value[, string $operator = '=' ][, string $operation = 'AND' ][, bool $useField = false ]) : mixed
Parameters
- $fields : string
- $value : mixed
- $operator : string = '='
- $operation : string = 'AND'
- $useField : bool = false
applyOperation()
Given a list of fields with operators: '|' for OR operations ',' for AND operations Returns an array with the field (key) and the operation (value).
public
static applyOperation(string $fields) : array<string|int, mixed>
Parameters
- $fields : string
Return values
array<string|int, mixed>getFieldsFilter()
Given a DataBaseWhere array, it returns the field list with their values that will be applied as a filter. (It only returns filters with the '=' operator).
public
static getFieldsFilter(array<string|int, mixed> $whereItems) : array<string|int, mixed>
Parameters
- $whereItems : array<string|int, mixed>
Return values
array<string|int, mixed>getSQLWhere()
Given a DataBaseWhere array, it returns the full WHERE clause.
public
static getSQLWhere(array<string|int, DataBaseWhere> $whereItems) : string
Parameters
- $whereItems : array<string|int, DataBaseWhere>
Return values
stringgetSQLWhereItem()
Returns a string to apply to the WHERE clause.
public
getSQLWhereItem([bool $applyOperation = false ][, string $prefix = '' ]) : string
Parameters
- $applyOperation : bool = false
- $prefix : string = ''
Return values
stringapplyValueToFields()
Apply one value to a field list.
private
applyValueToFields(mixed $value, array<string|int, mixed> $fields) : string
Parameters
- $value : mixed
- $fields : array<string|int, mixed>
Return values
stringescapeColumn()
private
escapeColumn(string $column) : string
Parameters
- $column : string
Return values
stringgetGroupPrefix()
Calculate if you need grouping of conditions.
private
static getGroupPrefix(DataBaseWhere $item, bool &$group) : string
It is necessary for logical conditions of type 'OR'
Parameters
- $item : DataBaseWhere
- $group : bool
Return values
stringgetValue()
Returns the filter value formatted according to the type.
private
getValue(string $value) : string
Parameters
- $value : string
Return values
stringgetValueFromOperator()
Returns the value for the operator.
private
getValueFromOperator(string $value) : string
Parameters
- $value : string
Return values
stringgetValueFromOperatorIn()
Return list values for IN operator.
private
getValueFromOperatorIn(string $values) : string
Parameters
- $values : string
Return values
stringgetValueFromOperatorLike()
Return value for LIKE operator.
private
getValueFromOperatorLike(string $value) : string
Parameters
- $value : string