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

[6.x] Override BelongsToMany::cursor() to hydrate pivot relations #30580

Merged
merged 1 commit into from Nov 13, 2019

Conversation

@mpyw
Copy link
Contributor

mpyw commented Nov 13, 2019

Overview

Currently pivot relations are not hydrated over cursor() request. We need to override it like each() chunk() chunkById() paginate() simplePaginate().

foreach (Post::first()->tags()->cursor() as $tag) {
    dump($tag->pivot->flag); // This cannot be correctly retrieved now
}

It seems that HasManyThrough::cursor() is already correctly implemented.

Related PRs

@mpyw mpyw force-pushed the mpyw:fix/add-missing-belongstomany-cursor branch 4 times, most recently from 03aa513 to 51d4cfa Nov 13, 2019
@mpyw mpyw force-pushed the mpyw:fix/add-missing-belongstomany-cursor branch from 51d4cfa to 7d85e54 Nov 13, 2019
@taylorotwell taylorotwell merged commit 2f3a8f1 into laravel:6.x Nov 13, 2019
2 checks passed
2 checks passed
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@mpyw mpyw deleted the mpyw:fix/add-missing-belongstomany-cursor branch Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.