Merge pull request #1397 from giosh94mhz/concat_expr_variable_arguments
Add Expr::concat support for multiple arguments
This commit is contained in:
commit
d7a3154954
@ -526,13 +526,13 @@ class Expr
|
|||||||
* Creates a CONCAT() function expression with the given arguments.
|
* Creates a CONCAT() function expression with the given arguments.
|
||||||
*
|
*
|
||||||
* @param mixed $x First argument to be used in CONCAT() function.
|
* @param mixed $x First argument to be used in CONCAT() function.
|
||||||
* @param mixed $y Second argument to be used in CONCAT() function.
|
* @param mixed $y,... Other arguments to be used in CONCAT() function.
|
||||||
*
|
*
|
||||||
* @return Expr\Func
|
* @return Expr\Func
|
||||||
*/
|
*/
|
||||||
public function concat($x, $y)
|
public function concat($x, $y)
|
||||||
{
|
{
|
||||||
return new Expr\Func('CONCAT', array($x, $y));
|
return new Expr\Func('CONCAT', func_get_args());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3464,7 +3464,7 @@ class Parser
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* FunctionsReturningStrings ::=
|
* FunctionsReturningStrings ::=
|
||||||
* "CONCAT" "(" StringPrimary "," StringPrimary ")" |
|
* "CONCAT" "(" StringPrimary "," StringPrimary {"," StringPrimary}* ")" |
|
||||||
* "SUBSTRING" "(" StringPrimary "," SimpleArithmeticExpression "," SimpleArithmeticExpression ")" |
|
* "SUBSTRING" "(" StringPrimary "," SimpleArithmeticExpression "," SimpleArithmeticExpression ")" |
|
||||||
* "TRIM" "(" [["LEADING" | "TRAILING" | "BOTH"] [char] "FROM"] StringPrimary ")" |
|
* "TRIM" "(" [["LEADING" | "TRAILING" | "BOTH"] [char] "FROM"] StringPrimary ")" |
|
||||||
* "LOWER" "(" StringPrimary ")" |
|
* "LOWER" "(" StringPrimary ")" |
|
||||||
|
@ -184,6 +184,7 @@ class ExprTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
public function testConcatExpr()
|
public function testConcatExpr()
|
||||||
{
|
{
|
||||||
$this->assertEquals('CONCAT(u.first_name, u.last_name)', (string) $this->_expr->concat('u.first_name', 'u.last_name'));
|
$this->assertEquals('CONCAT(u.first_name, u.last_name)', (string) $this->_expr->concat('u.first_name', 'u.last_name'));
|
||||||
|
$this->assertEquals('CONCAT(u.first_name, u.middle_name, u.last_name)', (string) $this->_expr->concat('u.first_name', 'u.middle_name', 'u.last_name'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubstringExpr()
|
public function testSubstringExpr()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user