TL;DR: Why does Doctrine's ArrayCollection only supports mapping an array without setting a key?
I want to create an associative array (key->value) from my Doctrine entities: i.e. customerId => CustomerName, userId => userName, etc. Creating an associative array isn't rocket science, so there are many other ways to achieve this.
However, I'm still wondering why ArrayCollection:map (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 ArrayCollection::set(). You can even create an array like this:
$arraycollection = new ArrayCollection();
$arraycollection->add('John Doe');
$arraycollection->set('foo', 'bar');
$arraycollection->set(418, 'teapot');
But you can't set keys with ArrayCollection::map(). 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?