title: symfony 4 count method with doctrine-orm
body: <p>I am a beginner in symfony 4, and I wanted to count the recording of an object, but it does not work.
  this is my code</p>
  
  <p>// Function count() in my repository class</p>
  
  <pre><code>public function count()
  {
      return $this-&gt;createQueryBuilder('d')
          -&gt;select('count(d.codeMarche) as count')
          -&gt;getQuery()
          -&gt;getSingleScalarResult();
  }
  </code></pre>
  
  <p>// in my controller class, i called my function count()</p>
  
  <pre><code>/**
    * @Route("/", name="home")
    */
  public function hom(MarcheDAORepository $repo){
     $count = $repo-&gt;count();
  
      return $this-&gt;render('index/home.html.twig', ['nbrDAO'=&gt;$count]);
  }
  </code></pre>
  
  <p>i need your help!!</p>