How to remove parameters from query builder?
<p>I have a problem with my query builder. I am using symfony. What i want to acomplish: I have a given query builder, and i want to count all rows based on this query. So i worked on following solution:</p>

<pre><code>$aliases = $queryBuilder-&gt;getRootAliases();
$alias = array_values($aliases)[0];

$cloneQueryBuilder = clone $queryBuilder;
$from = $cloneQueryBuilder-&gt;getDQLPart('from');

$cloneQueryBuilder-&gt;resetDQLParts();

$newQueryBuilder = $cloneQueryBuilder
    -&gt;select('count(' . $alias . '.id)')
    -&gt;add('from', $from[0]);

$this-&gt;total = $newQueryBuilder-&gt;getQuery()-&gt;getSingleScalarResult();
</code></pre>

<p>However im getting an exception : <code>Too many parameters: the query defines 0 parameters and you bound 1</code> Does anyone knows how to solve it ?</p>