Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Form] ChoiceList query builder should return arrays
ObjectChoiceList::initialize() is able to handle a Traversable object, which means getEntities() may safely return a cursor, but EntityChoiceList::getChoicesForValues() must return an array. To be consistent, return an array from both of these methods. For what it's worth, the ORM seems to natively return arrays for the corresponding methods in ORMQueryBuilderLoader. Note: Since ChoiceListInterface specifies that the arrays have "indices with ascending, 0-based numeric keys", strip the MongoCursor's document identifier keys by passing the results through array_values(). Ultimately, toArray() should be enhanced to allow passing a $use_keys argument to iterator_to_array().
- Loading branch information