I'm trying to use doctrine ORM querybuilder to do select using the IN 
function as a NULL/1 value

I did this in MySQL like this:

SELECT status IN ('APPROVED','REVIEW') as haveAccess
  FROM media WHERE group_id = 1;

The result would be this:

+------------+| haveAccess |+------------+|       NULL ||          1 
|+------------+

Now using querybuilder, I can't get it to work. I tried:

$qb->addSelect($qb->expr()->in('m.status',$arrayOfStatus));

$qb->addSelect($qb->expr()->in('m.status',$arrayOfStatus). " as haveAccess");

$implodedArray = implode(",",$arrayOfStatus);
$qb->addSelect("m.status IN ($implodedArray) as haveAccess");

The error I got is

[Semantical Error] line 0, col 28 near '('APPROVED','REVIEW')': Error: Class 
'(' is not defined.

I tried echoing out what the expr()->in() gives me:

echo $qb->expr()->in('m.status',$arrayOfStatus);//m.status 
IN('APPROVED','REVIEW')

and the output seems semantically correct. Does anyone have any idea?

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to