You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$comments = Comment::all();
$comments->load('commentable'); // this fails if you have the below schema
posts
post_id
title
body
111
Test Post
hello world
videos
video_id
title
video
222
Test Video
my-video.mov
comments
id
commentable_type
commentable_id
body
1
App\Post
111
"comment on a post"
2
App\Video
222
"comment on a video"
// This works (eager loading):$comments = App\Comment::with('commentable')->get();
// This fails (lazy loading):$comments = App\Comment::all();
$comments->load('commentable');
// > Results in "no such column: videos.post_id"
## Pull down my fork
git clone -b polymorphic-diff-keys git@github.com:fitztrev/framework.git polymorphic-diff-keys
cd polymorphic-diff-keys
composer install
## Run the tests## These 2 work
./vendor/bin/phpunit --filter testWithNoEagerOrLazyLoad
./vendor/bin/phpunit --filter testItCanEagerLoad
## This 1 fails
./vendor/bin/phpunit --filter testItCanLazyLoad
The text was updated successfully, but these errors were encountered:
Description:
You cannot lazy-load models of a polymorphic relationship that have different primary key columns.
This functionality broke with #21310.
Scenario:
posts
videos
comments
Steps To Reproduce:
I created a failing integration test to demonstrate.
The text was updated successfully, but these errors were encountered: