I have a repository function having the following instructions:
$QB = $this->_em->createQueryBuilder();
$QB ->addSelect("CONCAT(dsub2.dagId, MAX(tsub2.executionDate))")
->from(TaskInstance::class, 'tsub2')
->join('tsub2.dag', 'dsub2')
->addGroupBy('dsub2.dagId')
;
Calling $QB->getQuery()->getSQL();
or $QB->getQuery()->getResult()
raises an error saying:
Expected StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression, got 'MAX'
Replacing the addSelect
call entirely with the following snippet doesn't work either and raises the same error:
->addSelect(
$QB->expr()->concat(
'dsub2.dagId'
, $QB->expr()->max('tsub2.executionDate')
)
)
Do you have any idea of the proper way (or a workaround) to nest MAX
function call as a CONCAT
argument?
Doctrine DBAL v2.6.3 ; Doctrine ORM v2.6.1