title: fill in an associative array with a foreach php
body: <p>Why is this only give me the last value and not all the values in my db?</p>
  
  <pre><code>    $em = $this-&gt;getDoctrine()-&gt;getManager();
      $repo = $em-&gt;getRepository('ErpBundle:Sponsor');
      $clients = $repo-&gt;findAll();
      $array = array();
      foreach ($clients as $key =&gt;$client){
          $array['id'] = $client-&gt;getId();
          $array['value'] = $client-&gt;getName();
      }
     return $array
  </code></pre>