title: How to get a Doctrine2 result object as an associative array?
body: <p>I have a simple entity which is a table holding my user data
  and I want to fetch all columns of a specific user as an array and then json_encode them but what I get is an entity object which I will have to use get method for every value. I just want an associative array of my user table values.
  The codes I tried and didn't work (returned entity object) are as follows:
  1.</p>
  
  <pre><code>$qb = $this-&gt;em-&gt;createQueryBuilder();
  $qb-&gt;add('select', 'a')
  -&gt;add('from', 'Entities\Adminprofile a')
  -&gt;add('where', 'a.userid = 3333');
  $accounts = $qb-&gt;getQuery()-&gt;getResult();
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>$account = $this-&gt;em-&gt;getRepository('Entities\Adminprofile')-&gt;findOneBy(
  array('userid' =&gt; '3333'));
  </code></pre>
  
  <p>PS: im using z2d2 Project,which is doctrine2 integration into Zend framework.</p>