HumHub Documentation (unofficial)

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
author

Dmytro Naumenko d.naumenko.a@gmail.com

since
2.0.14
phpcs:disable

Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore

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

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 or NOT 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
throws
InvalidArgumentException

if wrong number of operands have been given.

Return values
$this

        
On this page

Search results