zendframework/zf2 — pull request #5636 by saltoledo (2013-12-21 17:35:31+00:00)
Title: Fix in the Collection Element implementation

The current implementation of Collection Element imposes, in prepareFieldset(), that the child element keys are set sequentially, starting from 0. After that, populateValues() will remove the unused indexes and add new ones, according to the input data. This behaviour breaks the test in this commit, as it expects that the first key will always be '0', which is not always true (as when collection elements are dinamically added or removed with javascript). The changes done here makes Collection Element more flexible and maybe a little faster, as it saves resources by avoiding unnecessary creation of child elements, adding them just when neccessary. Also, self::$lastChildIndex can be sent along with the template, so javascript can set a proper index for the next element to be added. FieldsetPrepareAwareInterface and all its references were removed, as they are no longer necessary.