Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
laravel-mongodb
Commits
b24f5d77
Commit
b24f5d77
authored
Aug 30, 2016
by
Pooya Parsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
null MorphTo relations
parent
0fc7c470
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
Model.php
src/Jenssegers/Mongodb/Eloquent/Model.php
+3
-2
No files found.
src/Jenssegers/Mongodb/Eloquent/Model.php
View file @
b24f5d77
...
@@ -8,6 +8,7 @@ use Jenssegers\Mongodb\Query\Builder as QueryBuilder;
...
@@ -8,6 +8,7 @@ use Jenssegers\Mongodb\Query\Builder as QueryBuilder;
use
Jenssegers\Mongodb\Relations\EmbedsMany
;
use
Jenssegers\Mongodb\Relations\EmbedsMany
;
use
Jenssegers\Mongodb\Relations\EmbedsOne
;
use
Jenssegers\Mongodb\Relations\EmbedsOne
;
use
Jenssegers\Mongodb\Relations\EmbedsOneOrMany
;
use
Jenssegers\Mongodb\Relations\EmbedsOneOrMany
;
use
Jenssegers\Mongodb\Relations\MorphTo
;
use
MongoDB\BSON\ObjectID
;
use
MongoDB\BSON\ObjectID
;
use
MongoDB\BSON\UTCDateTime
;
use
MongoDB\BSON\UTCDateTime
;
use
ReflectionMethod
;
use
ReflectionMethod
;
...
@@ -233,11 +234,11 @@ abstract class Model extends BaseModel
...
@@ -233,11 +234,11 @@ abstract class Model extends BaseModel
// This attribute matches an embedsOne or embedsMany relation so we need
// This attribute matches an embedsOne or embedsMany relation so we need
// to return the relation results instead of the interal attributes.
// to return the relation results instead of the interal attributes.
if
(
$relations
instanceof
EmbedsOneOrMany
)
{
if
(
$relations
instanceof
EmbedsOneOrMany
or
$relations
instanceof
MorphTo
)
{
// If the key already exists in the relationships array, it just means the
// If the key already exists in the relationships array, it just means the
// relationship has already been loaded, so we'll just return it out of
// relationship has already been loaded, so we'll just return it out of
// here because there is no need to query within the relations twice.
// here because there is no need to query within the relations twice.
if
(
array_key_exists
(
$key
,
$this
->
relations
))
{
if
(
array_key_exists
(
$key
,
$this
->
relations
)
&&
$this
->
relations
[
$key
]
!=
null
)
{
return
$this
->
relations
[
$key
];
return
$this
->
relations
[
$key
];
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment