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

[7.x] Fix inferred table reference for constrained #32847

Merged
merged 1 commit into from
May 16, 2020

Conversation

jasonmccreary
Copy link
Contributor

@jasonmccreary jasonmccreary commented May 16, 2020

There was a minor bug in the logic to infer the table name for the new constrained method where it would take the string before the first matching foreign key column string.

This yields incorrect table names for columns which contain the foreign key as a substring.

For example, laravel_idea_id or american_idol_id yield a table name of laravels or americans, respectively.

This patch corrects the table name and also converts the ternary shorthand to null coalesce for a bit of modernization and symmetry.

@taylorotwell taylorotwell merged commit fc77933 into laravel:7.x May 16, 2020
@GrahamCampbell GrahamCampbell changed the title Fix inferred table reference for constrained [7.x] Fix inferred table reference for constrained May 17, 2020
@jasonmccreary jasonmccreary deleted the fix-constraint-reference branch May 19, 2020 13:04
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