Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

doctrine2 DQL subquery 1 row limit

I want to do a DQL query like:

$dql = "select p
        from AcmeDemoBundle:UserTypeA p 
        where p.UserTypeB = :id
        and (
                 select top 1 r.boolean
                 from AcmeDemoBundle:Registry r
             ) 
        = true";

But it seems that TOP 1 it's not a valid function in doctrine2.

I can't figure out how can I limit the result of the subquery to one row.

like image 598
MSánchez Avatar asked Oct 05 '22 01:10

MSánchez


1 Answers

DQL does not support limits on subqueries and neither LIMIT nor OFFSET.

See http://www.doctrine-project.org/jira/browse/DDC-885

like image 144
Ocramius Avatar answered Oct 18 '22 08:10

Ocramius