class Condition

Object to reflect SQL conditions

Constants

VALID_OPERATORS

UNESCAPED_VALUES

OP_EQUAL

OP_LESS

OP_GREATER

OP_UNEQUAL

OP_GREATER_OR_EQUAL

OP_LESS_OR_EQUAL

OP_LIKE

OP_NOT_LIKE

OP_NULL

OP_NOT_NULL

OP_IN

Methods

__construct(string $field, string $operator = null, mixed $value = null, bool $isRaw = false, bool $negate = false)

Condition constructor

string
__toString()

No description

bool|string
getField()

No description

string
getSQL(string|null $table = null)

No description

bool|string
getValue()

No description

static Condition
where($field, $operator, $value)

No description

static Condition
whereBetween(string $field, int|string $beginValue, int|string $endValue)

Create between condition for string or int values BETWEEN is a shorthand for >= AND <= - begin and end values are included

static Condition
whereBinary(string $field, string $operator, string|array $hexValue)

No description

static Condition
whereEqual($field, $value)

No description

static ConditionGroup
whereGroup()

No description

static Condition
whereInSubselect(string $field, Query $subselect)

No description

static Condition
whereIsNotNull(string $field)

No description

static Condition
whereIsNull(string $field)

No description

static Condition
whereJSONContains(string $jsonField, mixed $candidate, string $jsonPath = null)

No description

static Condition
whereLike($field, $value)

No description

static Condition
whereNot($field, $operator, $value)

No description

static Condition
whereNotBetween(string $field, int|string $beginValue, int|string $endValue)

No description

static Condition
whereNotEqual($field, $value)

No description

static Condition
whereNotInSubselect(string $field, Query $subselect)

No description

static Condition
whereRaw(string $rawSQL)

No description

Details

at line 52
protected __construct(string $field, string $operator = null, mixed $value = null, bool $isRaw = false, bool $negate = false)

Condition constructor

Cases:

  1. Full: All three parameters are being passed ($field, $operator, $value)
  2. Shortend Equal: Only parameter 1 and 2 are being passed which results in an simple equal condition ($field, $value)
  3. RAW Condition: Only parameter 1 is being passed

Parameters

string $field
string $operator
mixed $value
bool $isRaw
bool $negate

at line 109
string __toString()

No description

Return Value

string

at line 86
bool|string getField()

No description

Return Value

bool|string

at line 102
string getSQL(string|null $table = null)

No description

Parameters

string|null $table

Should this condition be applied to a specific table or table alias?

Return Value

string

at line 93
bool|string getValue()

No description

Return Value

bool|string

at line 159
static Condition where($field, $operator, $value)

No description

Parameters

$field
$operator
$value

Return Value

Condition

at line 184
static Condition whereBetween(string $field, int|string $beginValue, int|string $endValue)

Create between condition for string or int values BETWEEN is a shorthand for >= AND <= - begin and end values are included

Parameters

string $field
int|string $beginValue
int|string $endValue

Return Value

Condition

at line 225
static Condition whereBinary(string $field, string $operator, string|array $hexValue)

No description

Parameters

string $field
string $operator
string|array $hexValue

Hexit presentation of binary data

Return Value

Condition

at line 122
static Condition whereEqual($field, $value)

No description

Parameters

$field
$value

Return Value

Condition

at line 79
static ConditionGroup whereGroup()

No description

Return Value

ConditionGroup

at line 252
static Condition whereInSubselect(string $field, Query $subselect)

No description

Parameters

string $field
Query $subselect

Return Value

Condition

at line 298
static Condition whereIsNotNull(string $field)

No description

Parameters

string $field

Return Value

Condition

at line 289
static Condition whereIsNull(string $field)

No description

Parameters

string $field

Return Value

Condition

at line 309
static Condition whereJSONContains(string $jsonField, mixed $candidate, string $jsonPath = null)

No description

Parameters

string $jsonField

Should be JSON type field

mixed $candidate

Will be JSON encoded

string $jsonPath

Return Value

Condition

at line 148
static Condition whereLike($field, $value)

No description

Parameters

$field
$value

Return Value

Condition

at line 170
static Condition whereNot($field, $operator, $value)

No description

Parameters

$field
$operator
$value

Return Value

Condition

at line 199
static Condition whereNotBetween(string $field, int|string $beginValue, int|string $endValue)

No description

Parameters

string $field
int|string $beginValue
int|string $endValue

Return Value

Condition

at line 135
static Condition whereNotEqual($field, $value)

No description

Parameters

$field
$value

Return Value

Condition

at line 265
static Condition whereNotInSubselect(string $field, Query $subselect)

No description

Parameters

string $field
Query $subselect

Return Value

Condition

at line 214
static Condition whereRaw(string $rawSQL)

No description

Parameters

string $rawSQL

Return Value

Condition