BetweenColumnsCondition
in package
implements
ConditionInterface
Class BetweenColumnCondition represents a `BETWEEN` condition where values is between two columns. For example:
new BetweenColumnsCondition(42, 'BETWEEN', 'min_value', 'max_value')
// Will be build to:
// 42 BETWEEN min_value AND max_value
And a more complex example:
new BetweenColumnsCondition(
new Expression('NOW()'),
'NOT BETWEEN',
(new Query)->select('time')->from('log')->orderBy('id ASC')->limit(1),
'update_time'
);
// Will be built to:
// NOW() NOT BETWEEN (SELECT time FROM log ORDER BY id ASC LIMIT 1) AND update_time
Tags
Table of Contents
Interfaces
- ConditionInterface
- Interface ConditionInterface should be implemented by classes that represent a condition in DBAL of framework.
Properties
- $intervalEndColumn : string|ExpressionInterface|Query
- $intervalStartColumn : string|ExpressionInterface|Query
- $operator : string
- $value : mixed
Methods
- __construct() : mixed
- Creates a condition with the `BETWEEN` operator.
- fromArrayDefinition() : $this
- Creates object by array-definition as described in [Query Builder – Operator format](guide:db-query-builder#operator-format) guide article.
- getIntervalEndColumn() : string|ExpressionInterface|Query
- getIntervalStartColumn() : string|ExpressionInterface|Query
- getOperator() : string
- getValue() : mixed
Properties
$intervalEndColumn
private
string|ExpressionInterface|Query
$intervalEndColumn
the column name or expression that is an end of the interval
$intervalStartColumn
private
string|ExpressionInterface|Query
$intervalStartColumn
the column name or expression that is a beginning of the interval
$operator
private
string
$operator
the operator to use (e.g. BETWEEN
or NOT BETWEEN
)
$value
private
mixed
$value
the value to compare against
Methods
__construct()
Creates a condition with the `BETWEEN` operator.
public
__construct(mixed $value, string $operator, string|ExpressionInterface $intervalStartColumn, string|ExpressionInterface $intervalEndColumn) : mixed
Parameters
- $value : mixed
- $operator : string
-
the operator to use (e.g.
BETWEEN
orNOT BETWEEN
) - $intervalStartColumn : string|ExpressionInterface
-
the column name or expression that is a beginning of the interval
- $intervalEndColumn : string|ExpressionInterface
-
the column name or expression that is an end of the interval
fromArrayDefinition()
Creates object by array-definition as described in [Query Builder – Operator format](guide:db-query-builder#operator-format) guide article.
public
static fromArrayDefinition(mixed $operator, mixed $operands) : $this
Parameters
- $operator : mixed
-
operator in uppercase.
- $operands : mixed
-
array of corresponding operands
Tags
Return values
$thisgetIntervalEndColumn()
public
getIntervalEndColumn() : string|ExpressionInterface|Query
Return values
string|ExpressionInterface|QuerygetIntervalStartColumn()
public
getIntervalStartColumn() : string|ExpressionInterface|Query
Return values
string|ExpressionInterface|QuerygetOperator()
public
getOperator() : string
Return values
stringgetValue()
public
getValue() : mixed