title: Create Associative array with ArrayCollection::map
body: <p><strong>TL;DR: Why does Doctrine's ArrayCollection only supports mapping an array without setting a key?</strong></p>
  
  <p>I want to create an associative array (key->value) from my Doctrine entities: i.e. <code>customerId =&gt; CustomerName</code>, <code>userId =&gt; userName</code>, etc. Creating an associative array isn't rocket science, so there are many other ways to achieve this.</p>
  
  <p>However, I'm still wondering why <code>ArrayCollection:map</code> (or a similar method) doesn't have an option to do this. Creating an array with keys is support by it's constructor method and <code>ArrayCollection::set()</code>. You can even create an array like this:</p>
  
  <pre><code>$arraycollection = new ArrayCollection();
  $arraycollection-&gt;add('John Doe');
  $arraycollection-&gt;set('foo', 'bar');
  $arraycollection-&gt;set(418, 'teapot');
  </code></pre>
  
  <p>But you can't set keys with <code>ArrayCollection::map()</code>. Why? Am I the first developer that is looking for a feature like this (not very likely) or am I missing an important principle that makes it unnecessary, impossible, undesireable or a bad practice?</p>