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
7438f7b1
Commit
7438f7b1
authored
Feb 12, 2016
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #736
parent
30bb30cd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
17 deletions
+30
-17
EmbedsMany.php
src/Jenssegers/Mongodb/Relations/EmbedsMany.php
+15
-0
EmbedsOne.php
src/Jenssegers/Mongodb/Relations/EmbedsOne.php
+15
-0
EmbedsOneOrMany.php
src/Jenssegers/Mongodb/Relations/EmbedsOneOrMany.php
+0
-17
No files found.
src/Jenssegers/Mongodb/Relations/EmbedsMany.php
View file @
7438f7b1
...
...
@@ -7,6 +7,21 @@ use MongoDB\BSON\ObjectID;
class
EmbedsMany
extends
EmbedsOneOrMany
{
/**
* Initialize the relation on a set of models.
*
* @param array $models
* @param string $relation
*/
public
function
initRelation
(
array
$models
,
$relation
)
{
foreach
(
$models
as
$model
)
{
$model
->
setRelation
(
$relation
,
$this
->
related
->
newCollection
());
}
return
$models
;
}
/**
* Get the results of the relationship.
*
...
...
src/Jenssegers/Mongodb/Relations/EmbedsOne.php
View file @
7438f7b1
...
...
@@ -5,6 +5,21 @@ use MongoDB\BSON\ObjectID;
class
EmbedsOne
extends
EmbedsOneOrMany
{
/**
* Initialize the relation on a set of models.
*
* @param array $models
* @param string $relation
*/
public
function
initRelation
(
array
$models
,
$relation
)
{
foreach
(
$models
as
$model
)
{
$model
->
setRelation
(
$relation
,
null
);
}
return
$models
;
}
/**
* Get the results of the relationship.
*
...
...
src/Jenssegers/Mongodb/Relations/EmbedsOneOrMany.php
View file @
7438f7b1
...
...
@@ -75,23 +75,6 @@ abstract class EmbedsOneOrMany extends Relation
// There are no eager loading constraints.
}
/**
* Initialize the relation on a set of models.
*
* @param array $models
* @param string $relation
*/
public
function
initRelation
(
array
$models
,
$relation
)
{
foreach
(
$models
as
$model
)
{
$model
->
setParentRelation
(
$this
);
$model
->
setRelation
(
$relation
,
$this
->
related
->
newCollection
());
}
return
$models
;
}
/**
* Match the eagerly loaded results to their parents.
*
...
...
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