Skip to content

Commit 18c62a3

Browse files
authored
Merge pull request #1 from jenssegers/master
Pull from original repo
2 parents 0015e51 + 3e5e9de commit 18c62a3

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

.github/workflows/build-ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ jobs:
1313
matrix:
1414
php: [7.1, 7.2, 7.3, 7.4]
1515
os: ['ubuntu-latest']
16+
mongodb: [3.6, 4.0, 4.2]
1617
services:
1718
mongo:
18-
image: mongo
19+
image: mongo:${{ matrix.mongodb }}
1920
ports:
2021
- 27017:27017
2122
mysql:
@@ -26,7 +27,7 @@ jobs:
2627
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
2728
MYSQL_DATABASE: 'unittest'
2829
MYSQL_ROOT_PASSWORD:
29-
name: PHP ${{ matrix.php }} Test ${{ matrix.env }}
30+
name: PHP ${{ matrix.php }} with mongo ${{ matrix.mongodb }}
3031

3132
steps:
3233
- uses: actions/checkout@v1
@@ -60,3 +61,4 @@ jobs:
6061
run: vendor/bin/php-coveralls -v
6162
env:
6263
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
continue-on-error: true

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
preset: laravel

src/Jenssegers/Mongodb/Eloquent/HybridRelations.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
184184
// there are multiple types in the morph and we can't use single queries.
185185
if (($class = $this->$type) === null) {
186186
return new MorphTo(
187-
$this->newQuery(), $this, $id, null, $type, $name
187+
$this->newQuery(), $this, $id, $ownerKey, $type, $name
188188
);
189189
}
190190

@@ -195,8 +195,10 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
195195

196196
$instance = new $class;
197197

198+
$ownerKey = $ownerKey ?? $instance->getKeyName();
199+
198200
return new MorphTo(
199-
$instance->newQuery(), $this, $id, $instance->getKeyName(), $type, $name
201+
$instance->newQuery(), $this, $id, $ownerKey, $type, $name
200202
);
201203
}
202204

0 commit comments

Comments
 (0)