class Doctrine_Expression (View source)

Doctrine_Expression memorizes a dql expression that use a db function.

This class manages abstractions of dql expressions like query parts that use CONCAT(), MIN(), SUM().

Properties

protected $_expression
protected $_conn
protected $_tokenizer

Methods

__construct(string $expr, Doctrine_Connection $conn = null)

Creates an expression.

getConnection()

Retrieves the connection associated to this expression at creation, or the current connection used if it was not specified.

void
setExpression(string $clause)

Sets the contained expression assuring that it is parsed.

string
parseExpression(string $expr)

Parses a single expressions and substitutes dql abstract functions with their concrete sql counterparts for the given connection.

string
parseClause(string $clause)

Parses a set of expressions at once.

string
getSql()

Gets the sql fragment represented.

string
__toString()

Magic method.

Details

__construct(string $expr, Doctrine_Connection $conn = null)

Creates an expression.

The constructor needs the dql fragment that contains one or more dbms functions. $e = new Doctrine_Expression("CONCAT('some', 'one')");

Parameters

string $expr sql fragment
Doctrine_Connection $conn the connection (optional)

Doctrine_Connection getConnection()

Retrieves the connection associated to this expression at creation, or the current connection used if it was not specified.

Return Value

Doctrine_Connection The connection

void setExpression(string $clause)

Sets the contained expression assuring that it is parsed.

$e->setExpression("CONCAT('some', 'one')");

Parameters

string $clause The expression to set

Return Value

void

string parseExpression(string $expr)

Parses a single expressions and substitutes dql abstract functions with their concrete sql counterparts for the given connection.

Parameters

string $expr The expression to parse

Return Value

string

string parseClause(string $clause)

Parses a set of expressions at once.

Parameters

string $clause The clause. Can be complex and parenthesised.

Return Value

string The parsed clause.

See also

parseExpression()

string getSql()

Gets the sql fragment represented.

Return Value

string

string __toString()

Magic method.

Returns a string representation of this object. Proxies to see getSql().

Return Value

string