8000 Allow MAX function as a CONCAT argument (improvement?) · Issue #7205 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Allow MAX function as a CONCAT argument (improvement?) #7205
Closed
@stphane

Description

@stphane

I recently migrated our project from doctrine v2.5.6 to v2.6.1. and ran into an error saying:

Expected StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression, got 'MAX'

… with the query being:

$QB = $this->_em->createQueryBuilder();
$QB ->addSelect("CONCAT(t2.dagId, MAX(t1.executionDate))")
    ->from(TaskInstance::class, 't1')
    ->join('t1.dag', 't2')
    ->addGroupBy('t2.dagId')
    ;


// Calling either getResults() or getSQL raises the error.
print_r($QB->getQuery()->getSQL());

After looking at Doctrine\ORM\Query\Parser::StringPrimary(), I ended up nesting MAX(…) call within a IF to fix the error:

$QB ->addSelect("CONCAT(t2.dagId, IF(1=1, MAX(t1.executionDate)))")

Is such a call rejection normal/intended or should this problem be addressed ?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0