Skip to content

Fix collection merging bug #97

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

Merged
merged 5 commits into from
May 6, 2024
Merged

Conversation

Menkveld-24
Copy link
Contributor

Scherm­afbeelding 2024-04-01 om 20 05 38

The ->put('url') overwrites the url part of the collection instead of adding to it upon GET requests.

Scherm­afbeelding 2024-04-01 om 20 06 30 Snippet run in tinkerwell now correctly merges the data into the collection

Would you also like me to extend the test for this? As the test only looks for the 'query' part inside the 'url'?

@andreaselia
Copy link
Owner

@Menkveld-24 good spot, and thanks for the PR. If you wouldn't mind extending the test surrounding this, that would be greatly appreciated 👍

@Menkveld-24
Copy link
Contributor Author

Hi, sorry for the late response. Been busy these weeks and kinda forgot about it. I'll try to do so this week

return $collection->put('url', [
'query' => $rules->map(fn ($value) => array_merge($value, ['disabled' => false])),
]);
return $collection->mergeRecursive(collect([
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to create a new collection to use mergeRecursive(), a simple array should do.

@Menkveld-24
Copy link
Contributor Author

Hehe, I've finally made some changes.
The test now checks the full get request instead of just the url query.

Also; saw this message about the deprecation of some tests or sth.
Scherm­afbeelding 2024-05-01 om 12 04 02

@Menkveld-24 Menkveld-24 requested a review from tomirons May 1, 2024 10:04
@tomirons
Copy link
Collaborator

tomirons commented May 1, 2024

@Menkveld-24 there's a failing test, are you able to fix it?

@Menkveld-24
Copy link
Contributor Author

Ofc! Somehow they didnt produce this error locally

@Menkveld-24
Copy link
Contributor Author

@tomirons Should be good rn

@andreaselia andreaselia merged commit c4f0015 into andreaselia:main May 6, 2024
3 checks passed
@andreaselia
Copy link
Owner

Thank you @Menkveld-24 and @tomirons ❤️

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

Successfully merging this pull request may close these issues.

3 participants