Methods |
public
|
__construct(Connection $connection)
Initializes a new <tt>ExpressionBuilder</tt>.
Initializes a new ExpressionBuilder.
Parameters
$connection |
The DBAL Connection.
|
|
#
|
public
|
and(string|CompositeExpression $expression, string|CompositeExpression ...$expressions): CompositeExpression
Creates a conjunction of the given expressions.
Creates a conjunction of the given expressions.
|
#
|
public
|
or(string|CompositeExpression $expression, string|CompositeExpression ...$expressions): CompositeExpression
Creates a disjunction of the given expressions.
Creates a disjunction of the given expressions.
|
#
|
public
|
andX(mixed $x = null): CompositeExpression
Deprecated
Parameters
$x |
Optional clause. Defaults = null, but requires
at least one defined when converting to string.
|
|
#
|
public
|
orX(mixed $x = null): CompositeExpression
Deprecated
Parameters
$x |
Optional clause. Defaults = null, but requires
at least one defined when converting to string.
|
|
#
|
public
|
comparison(mixed $x, string $operator, mixed $y): string
Creates a comparison expression.
Creates a comparison expression.
Parameters
$x |
The left expression.
|
$operator |
One of the ExpressionBuilder::* constants.
|
$y |
The right expression.
|
|
#
|
public
|
eq(mixed $x, mixed $y): string
Creates an equality comparison expression with the given arguments.
Creates an equality comparison expression with the given arguments.
First argument is considered the left expression and the second is the right expression.
When converted to string, it will generated a = . Example:
[php]
// u.id = ?
$expr->eq('u.id', '?');
Parameters
$x |
The left expression.
|
$y |
The right expression.
|
|
#
|
public
|
neq(mixed $x, mixed $y): string
Creates a non equality comparison expression with the given arguments.
First argument is considered the left expression…
Creates a non equality comparison expression with the given arguments.
First argument is considered the left expression and the second is the right expression.
When converted to string, it will generated a <> . Example:
[php]
// u.id <> 1
$q->where($q->expr()->neq('u.id', '1'));
Parameters
$x |
The left expression.
|
$y |
The right expression.
|
|
#
|
public
|
lt(mixed $x, mixed $y): string
Creates a lower-than comparison expression with the given arguments.
First argument is considered the left expression…
Creates a lower-than comparison expression with the given arguments.
First argument is considered the left expression and the second is the right expression.
When converted to string, it will generated a < . Example:
[php]
// u.id < ?
$q->where($q->expr()->lt('u.id', '?'));
Parameters
$x |
The left expression.
|
$y |
The right expression.
|
|
#
|
public
|
lte(mixed $x, mixed $y): string
Creates a lower-than-equal comparison expression with the given arguments.
First argument is considered the left…
Creates a lower-than-equal comparison expression with the given arguments.
First argument is considered the left expression and the second is the right expression.
When converted to string, it will generated a <= . Example:
[php]
// u.id <= ?
$q->where($q->expr()->lte('u.id', '?'));
Parameters
$x |
The left expression.
|
$y |
The right expression.
|
|
#
|
public
|
gt(mixed $x, mixed $y): string
Creates a greater-than comparison expression with the given arguments.
First argument is considered the left expression…
Creates a greater-than comparison expression with the given arguments.
First argument is considered the left expression and the second is the right expression.
When converted to string, it will generated a > . Example:
[php]
// u.id > ?
$q->where($q->expr()->gt('u.id', '?'));
Parameters
$x |
The left expression.
|
$y |
The right expression.
|
|
#
|
public
|
gte(mixed $x, mixed $y): string
Creates a greater-than-equal comparison expression with the given arguments.
First argument is considered the left…
Creates a greater-than-equal comparison expression with the given arguments.
First argument is considered the left expression and the second is the right expression.
When converted to string, it will generated a >= . Example:
[php]
// u.id >= ?
$q->where($q->expr()->gte('u.id', '?'));
Parameters
$x |
The left expression.
|
$y |
The right expression.
|
|
#
|
public
|
isNull(string $x): string
Creates an IS NULL expression with the given arguments.
Creates an IS NULL expression with the given arguments.
Parameters
$x |
The expression to be restricted by IS NULL.
|
|
#
|
public
|
isNotNull(string $x): string
Creates an IS NOT NULL expression with the given arguments.
Creates an IS NOT NULL expression with the given arguments.
Parameters
$x |
The expression to be restricted by IS NOT NULL.
|
|
#
|
public
|
like(string $x, mixed $y): string
Creates a LIKE() comparison expression with the given arguments.
Creates a LIKE() comparison expression with the given arguments.
Parameters
$x |
Field in string format to be inspected by LIKE() comparison.
|
$y |
Argument to be used in LIKE() comparison.
|
|
#
|
public
|
notLike(string $x, mixed $y): string
Creates a NOT LIKE() comparison expression with the given arguments.
Creates a NOT LIKE() comparison expression with the given arguments.
Parameters
$x |
Field in string format to be inspected by NOT LIKE() comparison.
|
$y |
Argument to be used in NOT LIKE() comparison.
|
|
#
|
public
|
in(string $x, string|string[] $y): string
Creates a IN () comparison expression with the given arguments.
Creates a IN () comparison expression with the given arguments.
Parameters
$x |
The field in string format to be inspected by IN() comparison.
|
$y |
The placeholder or the array of values to be used by IN() comparison.
|
|
#
|
public
|
notIn(string $x, string|string[] $y): string
Creates a NOT IN () comparison expression with the given arguments.
Creates a NOT IN () comparison expression with the given arguments.
Parameters
$x |
The expression to be inspected by NOT IN() comparison.
|
$y |
The placeholder or the array of values to be used by NOT IN() comparison.
|
|
#
|
public
|
literal(mixed $input, int|null $type = null): string
Quotes a given input parameter.
Quotes a given input parameter.
Parameters
$input |
The parameter to be quoted.
|
$type |
The type of the parameter.
|
|
#
|