The Doctrine query designer allows me to concatenate only two fields.
class Expr {
public function concat($x, $y);
To combine 3 fields, I use:
$qb->expr()->concat(
'table.field1',
$qb->expr()->concat('table.field2', 'table.field3')
);
And SQL will be:
CONCAT('table.field1', CONCAT('table.field2', 'table.field3'))
How to get one concat?
When I try to call directly
new Expr\Func('CONCAT', array('table.field1', 'table.field2', 'table.field3'));
Executing the request gives me an error
[Syntax error] line 0, col 237: Error: expected doctrine \ ORM \ Request \ Lexer :: T_CLOSE_PARENTHESIS, got ','
Dumping DQL:
CONCAT('table.field1', 'table.field2', 'table.field3')
Flushing SQL with $ qb-> getQuery () -> getSQL ():
[Syntax error] line 0, col 237: Error: expected doctrine \ ORM \ Request \ Lexer :: T_CLOSE_PARENTHESIS, got ','