Doctrine Query Builder delete all entries from Table
<p>i'm having some trouble deleting all records found by id using the query builder
I tried like the bellow code but i'm always getting this error:</p>

<pre><code> [Semantical Error] line 0, col 53 near 'b.id = :surv': Error: 'b' is not defined. 
</code></pre>

<p>The Method:</p>

<pre><code>public function deleteUsers($surveyId) {
    $qb = $this-&gt;getEntityManager()-&gt;createQueryBuilder();

    return $qb
        -&gt;delete()
        -&gt;from(BaseUser::class, 'a')
        -&gt;leftJoin('a.survey', 'b')
        -&gt;where('b.id = :survey')
        -&gt;setParameter('survey', $surveyId)
        -&gt;getQuery()
        -&gt;execute()
        ;
}
</code></pre>