In the context of the SonataAdminBundle / SonataUserBundle, I'm using the query builder to add static filters to the "list" query :
With this query, I get only users in the group "Juge", the query works well :
$query
->leftJoin( $query->getRootAlias().'.groups', 'g')
->andWhere( 'g.name = :group_name' )
->setParameter('group_name', 'Juge');
In an other Admin class, i want to do the oposite of this query : get the users who ARE NOT in the "Juge" group. How can I perform this? There is not outerJoin function in doctrine 2 right?
I used the following code and it works for me, its a kind of Outer Join.
I think you want to do
where
Expr
isDoctrine\ORM\Query\Expr
.