8000 [Bugfix] Fix qualifying columns for morph-to-many relations · chris-doehring/laravel-json-api@d2686e0 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit d2686e0

Browse files
committed
[Bugfix] Fix qualifying columns for morph-to-many relations
Laravel 8.15 introduced a breaking change by adding the qualify column method to the relation. Previously calling qualify column on the relation forwarded the call to the model.
1 parent dc52440 commit d2686e0

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
All notable changes to this project will be documented in this file. This project adheres to
33
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).
44

5+
## Unreleased
6+
7+
### Fixed
8+
- Fixed qualifying column for morph-to-many relations. This was caused by Laravel introducing
9+
a breaking change of adding a `qualifyColumn` method to the relation builder. Previously
10+
calling `qualifyColumn` on the relation forwarded the call to the model.
11+
512
## [3.1.0] - 2020-10-28
613

714
### Added

src/Eloquent/Concerns/SortsModels.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ protected function getQualifiedSortColumn($query, $field)
127127
{
128128
$key = $this->getSortColumn($field, $query->getModel());
129129

130-
return $query->qualifyColumn($key);
130+
return $query->getModel()->qualifyColumn($key);
131131
}
132132

133133
/**

tests/lib/Integration/Eloquent/MorphToManyTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ public function testReadRelated()
238238

239239
$post->tags()->sync($tags);
240240

241-
$this->doReadRelated($post, 'tags')
241+
$this->withoutExceptionHandling()
242+
->doReadRelated($post, 'tags')
242243
->willSeeType('tags')
243244
->assertFetchedMany($expected);
244245
}

0 commit comments

Comments
 (0)
0