Skip to content

Commit

Permalink
Add Expr::concat support for multiple arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
giosh94mhz committed May 15, 2015
1 parent 900b55d commit 61e33e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Doctrine/ORM/Query/Expr.php
Expand Up @@ -526,13 +526,13 @@ public function notLike($x, $y)
* Creates a CONCAT() function expression with the given arguments.
*
* @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
*/
public function concat($x, $y)
{
return new Expr\Func('CONCAT', array($x, $y));
return new Expr\Func('CONCAT', func_get_args());
}

/**
Expand Down
5 changes: 3 additions & 2 deletions tests/Doctrine/Tests/ORM/Query/ExprTest.php
Expand Up @@ -184,6 +184,7 @@ public function testNotLikeExpr()
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.middle_name, u.last_name)', (string) $this->_expr->concat('u.first_name', 'u.middle_name', 'u.last_name'));
}

public function testSubstringExpr()
Expand Down Expand Up @@ -429,14 +430,14 @@ public function testExpressionGetter()
public function testAddEmpty() {
$andExpr = $this->_expr->andx();
$andExpr->add($this->_expr->andx());

$this->assertEquals(0, $andExpr->count());
}

public function testAddNull() {
$andExpr = $this->_expr->andx();
$andExpr->add(null);

$this->assertEquals(0, $andExpr->count());
}
}

0 comments on commit 61e33e5

Please sign in to comment.