Doctrine


Doctrine\ORM\Query\Expr
/Doctrine/ORM/Query/Expr.php at line 36

Class Expr

Expr

public class Expr

This class is used to generate DQL expressions via a set of PHP static functions

License:
http://www.opensource.org/licenses/lgpl-license.php LGPL
See Also:
www.doctrine-project.org
Since:
2.0
Version:
$Revision$
Author:
Guilherme Blanco
Jonathan Wage
Roman Borschel
Todo:
Rename: ExpressionBuilder

Method Summary
Expr\Func

abs(mixed x)

Creates an ABS() function expression with the given argument.

Expr\Func

all(mixed subquery)

Creates an instance of ALL() function, with the given DQL Subquery.

Expr\Andx

andX(mixed x)

Creates a conjunction of the given boolean expressions.

Expr\Func

any(mixed subquery)

Creates an ANY() function expression with the given DQL subquery.

OrderBy

asc(mixed expr, $sort )

Creates an ASCending order expression.

Expr\Func

avg(mixed x)

Creates an instance of AVG() function, with the given argument.

Expr\Func

between(mixed val, integer x, integer y)

Creates an instance of BETWEEN() function, with the given argument.

Expr\Func

concat(mixed x, mixed y)

Creates a CONCAT() function expression with the given arguments.

Expr\Func

count(mixed x)

Creates an instance of COUNT() function, with the given argument.

string

countDistinct(mixed x)

Creates an instance of COUNT(DISTINCT) function, with the given argument.

OrderBy

desc(mixed expr, $sort )

Creates a DESCending order expression.

Expr\Math

diff(mixed x, mixed y)

Creates a difference mathematical expression with the given arguments.

Expr\Comparison

eq(mixed x, mixed y)

Creates an equality comparison expression with the given arguments.

Expr\Func

exists(mixed subquery)

Creates an instance of EXISTS() function, with the given DQL Subquery.

Expr\Comparison

gt(mixed x, mixed y)

Creates an instance of Expr\Comparison, with the given arguments.

Expr\Comparison

gte(mixed x, mixed y)

Creates an instance of Expr\Comparison, with the given arguments.

Expr\Func

in(string x, mixed y)

Creates an IN() expression with the given arguments.

Expr\Func

length(mixed x)

Creates a LENGTH() function expression with the given argument.

Expr\Comparison

like(string x, mixed y)

Creates a LIKE() comparison expression with the given arguments.

Expr\Literal

literal(mixed literal)

Creates a literal expression of the given argument.

Expr\Func

lower(mixed x)

Creates a LOWER() function expression with the given argument.

Expr\Comparison

lt(mixed x, mixed y)

Creates an instance of Expr\Comparison, with the given arguments.

Expr\Comparison

lte(mixed x, mixed y)

Creates an instance of Expr\Comparison, with the given arguments.

Expr\Func

max(mixed x)

Creates an instance of MAX() function, with the given argument.

Expr\Func

min(mixed x)

Creates an instance of MIN() function, with the given argument.

Expr\Comparison

neq(mixed x, mixed y)

Creates an instance of Expr\Comparison, with the given arguments.

Expr\Func

not(mixed restriction)

Creates a negation expression of the given restriction.

Expr\Func

notIn(string x, mixed y)

Creates a NOT IN() expression with the given arguments.

Expr\Orx

orX(mixed x)

Creates a disjunction of the given boolean expressions.

Expr\Math

prod(mixed x, mixed y)

Creates a product mathematical expression with the given arguments.

Expr\Math

quot(mixed x, mixed y)

Creates a quotient mathematical expression with the given arguments.

Expr\Func

some(mixed subquery)

Creates a SOME() function expression with the given DQL subquery.

Expr\Func

sqrt(mixed x)

Creates a SQRT() function expression with the given argument.

Expr\Func

substring(mixed x, integer from, integer len)

Creates a SUBSTRING() function expression with the given arguments.

Expr\Math

sum(mixed x, mixed y)

Creates a sum mathematical expression with the given arguments.

Expr\Func

trim(mixed x)

Creates an instance of TRIM() function, with the given argument.

Expr\Func

upper(mixed x)

Creates an UPPER() function expression with the given argument.

Method Detail

/Doctrine/ORM/Query/Expr.php at line 321

abs

public Expr\Func abs(mixed x)

Creates an ABS() function expression with the given argument.

Parameters:
x - Argument to be used in ABS() function.

/Doctrine/ORM/Query/Expr.php at line 277

all

public Expr\Func all(mixed subquery)

Creates an instance of ALL() function, with the given DQL Subquery.

Parameters:
subquery - DQL Subquery to be used in ALL() function.

/Doctrine/ORM/Query/Expr.php at line 51

andX

public Expr\Andx andX(mixed x)

Creates a conjunction of the given boolean expressions.

Example:

[php] (u.type = ?1) AND (u.role = ?2) $expr->andX('u.type = ?1', 'u.role = ?2'));

Parameters:
x - Optional clause. Defaults = null, but requires at least one defined when converting to string.

/Doctrine/ORM/Query/Expr.php at line 299

any

public Expr\Func any(mixed subquery)

Creates an ANY() function expression with the given DQL subquery.

Parameters:
subquery - DQL Subquery to be used in ANY() function.

/Doctrine/ORM/Query/Expr.php at line 80

asc

public OrderBy asc(mixed expr, $sort )

Creates an ASCending order expression.


/Doctrine/ORM/Query/Expr.php at line 211

avg

public Expr\Func avg(mixed x)

Creates an instance of AVG() function, with the given argument.

Parameters:
x - Argument to be used in AVG() function.

/Doctrine/ORM/Query/Expr.php at line 545

between

public Expr\Func between(mixed val, integer x, integer y)

Creates an instance of BETWEEN() function, with the given argument.

Parameters:
val - Valued to be inspected by range values.
x - Starting range value to be used in BETWEEN() function.
y - End point value to be used in BETWEEN() function.
Returns:
A BETWEEN expression.

/Doctrine/ORM/Query/Expr.php at line 460

concat

public Expr\Func concat(mixed x, mixed y)

Creates a CONCAT() function expression with the given arguments.

Parameters:
x - First argument to be used in CONCAT() function.
x - Second argument to be used in CONCAT() function.

/Doctrine/ORM/Query/Expr.php at line 244

count

public Expr\Func count(mixed x)

Creates an instance of COUNT() function, with the given argument.

Parameters:
x - Argument to be used in COUNT() function.

/Doctrine/ORM/Query/Expr.php at line 255

countDistinct

public string countDistinct(mixed x)

Creates an instance of COUNT(DISTINCT) function, with the given argument.

Parameters:
x - Argument to be used in COUNT(DISTINCT) function.

/Doctrine/ORM/Query/Expr.php at line 91

desc

public OrderBy desc(mixed expr, $sort )

Creates a DESCending order expression.


/Doctrine/ORM/Query/Expr.php at line 358

diff

public Expr\Math diff(mixed x, mixed y)

Creates a difference mathematical 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.monthlySubscriptionCount - 1 $q->expr()->diff('u.monthlySubscriptionCount', '1')

Parameters:
x - Left expression
y - Right expression

/Doctrine/ORM/Query/Expr.php at line 110

eq

public Expr\Comparison eq(mixed x, mixed y)

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 = ?1 $expr->eq('u.id', '?1');

Parameters:
x - Left expression
y - Right expression

/Doctrine/ORM/Query/Expr.php at line 266

exists

public Expr\Func exists(mixed subquery)

Creates an instance of EXISTS() function, with the given DQL Subquery.

Parameters:
subquery - DQL Subquery to be used in EXISTS() function.

/Doctrine/ORM/Query/Expr.php at line 182

gt

public Expr\Comparison gt(mixed x, mixed y)

Creates an instance of Expr\Comparison, 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()->gt('u.id', '?1'));

Parameters:
x - Left expression
y - Right expression

/Doctrine/ORM/Query/Expr.php at line 200

gte

public Expr\Comparison gte(mixed x, mixed y)

Creates an instance of Expr\Comparison, 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()->gte('u.id', '?1'));

Parameters:
x - Left expression
y - Right expression

/Doctrine/ORM/Query/Expr.php at line 417

in

public Expr\Func in(string x, mixed y)

Creates an IN() expression with the given arguments.

Parameters:
x - Field in string format to be restricted by IN() function
y - Argument to be used in IN() function.

/Doctrine/ORM/Query/Expr.php at line 506

length

public Expr\Func length(mixed x)

Creates a LENGTH() function expression with the given argument.

Parameters:
x - Argument to be used as argument of LENGTH() function.
Returns:
A LENGTH function expression.

/Doctrine/ORM/Query/Expr.php at line 448

like

public Expr\Comparison like(string x, mixed y)

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.

/Doctrine/ORM/Query/Expr.php at line 517

literal

public Expr\Literal literal(mixed literal)

Creates a literal expression of the given argument.

Parameters:
literal - Argument to be converted to literal.

/Doctrine/ORM/Query/Expr.php at line 484

lower

public Expr\Func lower(mixed x)

Creates a LOWER() function expression with the given argument.

Parameters:
x - Argument to be used in LOWER() function.
Returns:
A LOWER function expression.

/Doctrine/ORM/Query/Expr.php at line 146

lt

public Expr\Comparison lt(mixed x, mixed y)

Creates an instance of Expr\Comparison, 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()->lt('u.id', '?1'));

Parameters:
x - Left expression
y - Right expression

/Doctrine/ORM/Query/Expr.php at line 164

lte

public Expr\Comparison lte(mixed x, mixed y)

Creates an instance of Expr\Comparison, 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()->lte('u.id', '?1'));

Parameters:
x - Left expression
y - Right expression

/Doctrine/ORM/Query/Expr.php at line 222

max

public Expr\Func max(mixed x)

Creates an instance of MAX() function, with the given argument.

Parameters:
x - Argument to be used in MAX() function.

/Doctrine/ORM/Query/Expr.php at line 233

min

public Expr\Func min(mixed x)

Creates an instance of MIN() function, with the given argument.

Parameters:
x - Argument to be used in MIN() function.

/Doctrine/ORM/Query/Expr.php at line 128

neq

public Expr\Comparison neq(mixed x, mixed y)

Creates an instance of Expr\Comparison, 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 - Left expression
y - Right expression

/Doctrine/ORM/Query/Expr.php at line 310

not

public Expr\Func not(mixed restriction)

Creates a negation expression of the given restriction.

Parameters:
restriction - Restriction to be used in NOT() function.

/Doctrine/ORM/Query/Expr.php at line 436

notIn

public Expr\Func notIn(string x, mixed y)

Creates a NOT IN() expression with the given arguments.

Parameters:
x - Field in string format to be restricted by NOT IN() function
y - Argument to be used in NOT IN() function.

/Doctrine/ORM/Query/Expr.php at line 69

orX

public Expr\Orx orX(mixed x)

Creates a disjunction of the given boolean expressions.

Example:

[php] (u.type = ?1) OR (u.role = ?2) $q->where($q->expr()->orX('u.type = ?1', 'u.role = ?2'));

Parameters:
x - Optional clause. Defaults = null, but requires at least one defined when converting to string.

/Doctrine/ORM/Query/Expr.php at line 340

prod

public Expr\Math prod(mixed x, mixed y)

Creates a product mathematical 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.salary * u.percentAnualSalaryIncrease $q->expr()->prod('u.salary', 'u.percentAnualSalaryIncrease')

Parameters:
x - Left expression
y - Right expression

/Doctrine/ORM/Query/Expr.php at line 394

quot

public Expr\Math quot(mixed x, mixed y)

Creates a quotient mathematical 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.total / u.period $expr->quot('u.total', 'u.period')

Parameters:
x - Left expression
y - Right expression

/Doctrine/ORM/Query/Expr.php at line 288

some

public Expr\Func some(mixed subquery)

Creates a SOME() function expression with the given DQL subquery.

Parameters:
subquery - DQL Subquery to be used in SOME() function.

/Doctrine/ORM/Query/Expr.php at line 405

sqrt

public Expr\Func sqrt(mixed x)

Creates a SQRT() function expression with the given argument.

Parameters:
x - Argument to be used in SQRT() function.

/Doctrine/ORM/Query/Expr.php at line 473

substring

public Expr\Func substring(mixed x, integer from, integer len)

Creates a SUBSTRING() function expression with the given arguments.

Parameters:
x - Argument to be used as string to be cropped by SUBSTRING() function.
from - Initial offset to start cropping string. May accept negative values.
len - Length of crop. May accept negative values.

/Doctrine/ORM/Query/Expr.php at line 376

sum

public Expr\Math sum(mixed x, mixed y)

Creates a sum mathematical 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.numChildren + 1 $q->expr()->diff('u.numChildren', '1')

Parameters:
x - Left expression
y - Right expression

/Doctrine/ORM/Query/Expr.php at line 556

trim

public Expr\Func trim(mixed x)

Creates an instance of TRIM() function, with the given argument.

Parameters:
x - Argument to be used as argument of TRIM() function.
Returns:
a TRIM expression.

/Doctrine/ORM/Query/Expr.php at line 495

upper

public Expr\Func upper(mixed x)

Creates an UPPER() function expression with the given argument.

Parameters:
x - Argument to be used in UPPER() function.
Returns:
An UPPER function expression.

Doctrine