Arkounay / ux-collection

Collection for Symfony forms using Symfony UX
MIT License
37 stars 5 forks source link

[Feature idea] Add "init_with_n_elements" option #9

Closed bastien70 closed 7 months ago

bastien70 commented 7 months ago

Hey! Maybe it could be possible to add the "init_with_n_elements" to init the collection with X elements? :)

Seems that your (awesome) bundle is inspired by https://github.com/ninsuo/symfony-collection ? In this case, maybe it's possible? :D

EDIT : Sorry, I didn't see that the "min" option had the effect of initializing the minimum number of elements.

In the end, it does exactly the same thing so the "init_with_n_element" should no longer be used

Arkounay commented 7 months ago

Hi, yes the bundle was a bit inspired by ninsuo/symfony-collection :)

As you said min can do the trick I think in ninsuo init_with_n_element still allowed to remove elements afterwards unlike min here, but the same functionality can be achieved by pre-populating the collection in PHP (even with empty objects)