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

Fix: Correct import to resolve TypeError in RefundItemCollection #265

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

bobab12
Copy link
Contributor

@bobab12 bobab12 commented Oct 17, 2024

Got this TypeError while unserializing a RefundProcessed event from a queue:

TypeError: Illuminate\Database\Eloquent\Relations\HasMany::match(): Argument #2 ($results) must be of type Illuminate\Database\Eloquent\Collection, Laravel\Cashier\Refunds\RefundItemCollection given, called in /srv/app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php on line 785 and defined in /srv/app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php:60

The error occurred because RefundItemCollection extended Illuminate\Support\Collection instead of Illuminate\Database\Eloquent\Collection, leading to a type mismatch in Eloquent relationships that require the latter.

This change fixes the issue by extending from the correct Eloquent\Collection.

Copy link
Collaborator

@sandervanhooft sandervanhooft left a comment

Choose a reason for hiding this comment

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

Good catch!

@sandervanhooft sandervanhooft merged commit 8de43ec into mollie:main Oct 18, 2024
6 checks passed
@sandervanhooft
Copy link
Collaborator

Patched and released, thanks @bobab12 !

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.

2 participants