title: Symfony 4, doctrine, getResult and getArrayResult and getScalarResult return same structure results
body: <p>From symfony 4, I create a sample repository class. From this class, I created a method for get the list of all email's users. I would like get a array structure like this : </p>
  
  <pre><code>array(
      "email1",
      "email2",
      "email3",
      ...       
  )
  </code></pre>
  
  <p>But with 'getResult' I get a multidimensional array. Then, I tested with getArrayResult and getScalarResult and I obtain each time exactly the same array structure result ! </p>
  
  <p>Below, my Service Class : </p>
  
  <pre><code>&lt;?php
  class UserRepository extends ServiceEntityRepository
  {
      public function __construct(RegistryInterface $registry)
      {
          parent::__construct($registry, User::class);
      }
  
      public function getAllEmail(){
          $result = $this-&gt;createQueryBuilder('u')
              -&gt;select(array('u.email'))
              -&gt;setMaxResults(5)
              -&gt;getQuery();
          return array( // getResult &amp;&amp; getArrayResult &amp;&amp; getScalarResult return exactly same array structure
              "getResult" =&gt; $result-&gt;getResult(),
              "getArrayResult" =&gt; $result-&gt;getArrayResult(), 
              "getScalarResult" =&gt; $result-&gt;getScalarResult(),
          );
      }
  }
  </code></pre>
  
  <p>And the result when I dump the output of "getAllEmail()" : </p>
  
  <p><a href="https://i.stack.imgur.com/XRp47.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XRp47.png" alt="enter image description here"></a></p>
  
  <p>Why getResult / getArrayResult / getScalarResult return exactly same array structure ? I do a mistake somewhere ?</p>
  
  <p>Edit : I modified my Repository Class :</p>
  
  <pre><code>public function getAllEmail(){
      $result = $this-&gt;createQueryBuilder('u','u.email')
          -&gt;setMaxResults(5)
          -&gt;getQuery();
      return array(
          "getResult" =&gt; $result-&gt;getResult(),
          "getArrayResult" =&gt; $result-&gt;getArrayResult(),
          "getScalarResult" =&gt; $result-&gt;getScalarResult(),
      );
  }
  </code></pre>
  
  <p>And the dump output : </p>
  
  <p><a href="https://i.stack.imgur.com/BgLwH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BgLwH.png" alt="enter image description here"></a> </p>
  
  <p>With 'getResult' and 'getArrayResult' I get an multidimensional array and in the first dimension, I get all email (emails are the key). I approach more my goal but its not perfect. I'm looking for the 'light weight' way (sorry for my english -_-), I would like get only email (and not email + another useless users information) because I want execute the simplest query as possible. Is it possible ?  </p>