-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Issue with distinct #341
Comments
Hi, Thanks for the issue and taking the time to provide a quick reproducer. To fix the issue gracefully, I would use $result = $base_list->diff(...$excluded_list); |
In my case, i start with a list of integers that are mapped to value objects: $excluded_list = Collection::fromIterable([2])
->distinct()
->map(fn ($v) => new ValueObject($v)); later comes the filtering logic. Currently, I've managed to "bypass" the lazy mechanism by creating a new collection Collection::fromIterable($excluded_list->all()); after using distinct, this helps in my case. Thanks for the quick response! EDIT: Sorry, I accidentally closed this issue |
Since this issue has not had any activity within the last 5 days, I have marked it as stale. |
Steps required to reproduce the problem
I have two arrays:
And I want to efficiently remove elements from the base list using the second list:
Expected Result
Actual Result
Version
I found that something is wrong with ->distinct(). When I remove it, the code above works fine.
It seems to me that 'distinct' shouldn't have an impact on the outcome in this case. Am I mistaken 😉?
The text was updated successfully, but these errors were encountered: