Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Doctrine ArrayCollection::partition() like #61

Open
benjaminmal opened this issue Jun 29, 2020 · 1 comment
Open

Add Doctrine ArrayCollection::partition() like #61

benjaminmal opened this issue Jun 29, 2020 · 1 comment

Comments

@benjaminmal
Copy link

Is your feature request related to a problem? Please describe.

Yes, when I need to split a CollectionInterface in two, I have to use CollectionInterface::filter twice with opposite callbacks, which is not very efficient.

Describe the solution you'd like

I found out that Doctrine ArrayCollection is using a partition method which doesn't itinerate twice in the collection. So it could be very useful to have this method in this project! I can submit a PR if needed.

Describe alternatives you've considered

I am not sure if it is better to implement the method in ArrayInterface or CollectionInterface (and related abstract method of course). What do you think?

Additional context

Or maybe there is a way to do the same without modifying the project?

Thanks

Thanks for your work ;)

@benjaminmal benjaminmal changed the title Add Doctrine partition() like Add Doctrine ArrayCollection::partition() like Jun 29, 2020
@SimoTod
Copy link
Contributor

SimoTod commented Jul 1, 2020

Collections are iterable so you can already loop once and manually build 2 new collections.
I agree, a partition function (on collectioninterface imo) would make it look nicer though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants