‘where not in’ query with doctrine query builder

You need to use query builder expressions, and this means you need access to the query builder object. Also, the code is easier to write if you generate the subselect list ahead of time: $qb = $em->createQueryBuilder(); $nots = $qb->select(‘arl’) ->from(‘$MineMyBundle:MineAssetRequestLine’, ‘arl’) ->where($qb->expr()->eq(‘arl.asset_id’,1)) ->getQuery() ->getResult(); $linked = $qb->select(‘rl’) ->from(‘MineMyBundle:MineRequestLine’, ‘rl’) ->where($qb->expr()->notIn(‘rl.request_id’, $nots)) ->getQuery() ->getResult();

Doctrine – How to print out the real sql, not just the prepared statement?

Doctrine is not sending a “real SQL query” to the database server : it is actually using prepared statements, which means : Sending the statement, for it to be prepared (this is what is returned by $query->getSql()) And, then, sending the parameters (returned by $query->getParameters()) and executing the prepared statements This means there is never … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)