 <p>Found a way:</p> <pre><code>/** * @param Organization $organization * @param User $user * @return \Doctrine\ORM\QueryBuilder */ public function getFindByOrganizationQueryBuilder(Organization $organization, User $user) { $nots = $this-&gt;_em -&gt;createQueryBuilder() -&gt;select('u.id') -&gt;from('AppBundle:User\User', 'u', 'u.id') -&gt;leftJoin('u.roles', 'r') -&gt;where('r.role = ?1') -&gt;orWhere('r.role = ?2') -&gt;setParameter(1, 'ROLE_ADMIN') -&gt;setParameter(2, 'ROLE_SUPER_ADMIN') -&gt;getQuery() -&gt;getResult() ; $nots = array_keys($nots); $builder = $this -&gt;createQueryBuilder('u') -&gt;leftJoin('u.roles', 'r') -&gt;leftJoin('u.associates', 'a') -&gt;leftJoin('a.organization', 'o') -&gt;where('o = ?1') -&gt;andWhere('u &lt;&gt; ?2') -&gt;setParameter(1, $organization) -&gt;setParameter(2, $user) ; if (!empty($nots)) { $builder = $builder -&gt;andWhere($this-&gt;createQueryBuilder('u')-&gt;expr()-&gt;notIn('u.id', $nots)); } return $builder; } </code></pre>