-
Notifications
You must be signed in to change notification settings - Fork 56
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
Q: Strict collections intersection #45
Comments
Hmm, i see. I think the solution could be to rewrite intersect so that we iterate over first 2 collections, create a temporary collection of the intersection, then repeat this over the next collection, the next and so on. This would not create a BC so it should be fine and will also lessen the memory load. Would this solve your problem? |
Hello, thanks for the answer. It would probably not help as the "problem" occurs also during the intersection of two collections which contains some PhpUnit mocks of Doctrine entities. |
Sorry, i misunderstood, i thought the problem was being with large collections. In the case of large objects we could introduce a method For now however, your best bet is calling filter/reject to remove the elements that are in both collections and then checking if the result is an empty collection. |
I'm digressing from topic a bit, but |
Hello,
is there any way how to compare collections strictly in the intersect() method?
The problem is that the
in_array
function used at https://github.com/DusanKasan/Knapsack/blob/master/src/collection_functions.php#L1301 causes the "Nesting level too deep - recursive dependency?" error when using a Collection of big objects.I have been thinking about sending a PR with the third param set to true; however then I realised that it could be a big BC break for some users so I would like to ask you if you have some workaround suggestion instead, pelase.
Thanks!
The text was updated successfully, but these errors were encountered: