在PHP中格式化Doctrine SubQuery

I Have this query :

$qb->select("
    tab.product
    ,round(
        (               
            SELECT COUNT( tab2.price )

            FROM Application\Entity\PSRespostas tab2 

            WHERE 
                tab.key = tab2.codkey 
            )
    ,2) as GridPercent
");
  • But when i execute it occurs the error:

[Syntax Error] line 0, col 266: Error: Expected Literal, got 'SELECT'

I tried Without the ROUND or any function it works, but i need to do it by SQL query.

it occurs with anyone ? , ask if need more information for the query. :(

obs.: i can't do it on Join because the query does some Groups By and more complex functions that do not permit me to use anything else but a SubQuery