Doctrine - Store ArrayCollection keys
问题 Whenever I use an ArrayCollection with Doctrine ORM (2.3, PHP > 5.4), and associate the object values with a key in the collection (such as when using the set method), the values get stored correctly in the database. But when I want to retrieve the collection from the entity, the keys don't get retrieved and instead they use a numeric index. For instance, if I have the following classes: /** @Entity */ class MyEntity { /** @OneToMany(targetEntity="MyOtherEntity", mappedBy="mainEntity") */