Skip to content

update #2

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

Merged
merged 7 commits into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ jobs:
matrix:
php: [7.1, 7.2, 7.3, 7.4]
os: ['ubuntu-latest']
mongodb: [3.6, 4.0, 4.2]
services:
mongo:
image: mongo
image: mongo:${{ matrix.mongodb }}
ports:
- 27017:27017
mysql:
Expand All @@ -26,7 +27,7 @@ jobs:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_DATABASE: 'unittest'
MYSQL_ROOT_PASSWORD:
name: PHP ${{ matrix.php }} Test ${{ matrix.env }}
name: PHP ${{ matrix.php }} with mongo ${{ matrix.mongodb }}

steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -60,3 +61,4 @@ jobs:
run: vendor/bin/php-coveralls -v
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
6 changes: 4 additions & 2 deletions src/Jenssegers/Mongodb/Eloquent/HybridRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null
// there are multiple types in the morph and we can't use single queries.
if (($class = $this->$type) === null) {
return new MorphTo(
$this->newQuery(), $this, $id, null, $type, $name
$this->newQuery(), $this, $id, $ownerKey, $type, $name
);
}

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

$instance = new $class;

$ownerKey = $ownerKey ?? $instance->getKeyName();

return new MorphTo(
$instance->newQuery(), $this, $id, $instance->getKeyName(), $type, $name
$instance->newQuery(), $this, $id, $ownerKey, $type, $name
);
}

Expand Down