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
ae621465
Commit
ae621465
authored
Mar 26, 2014
by
Alexandre Butynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix infinite loo toArray() bug
parent
84f1df5e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
0 deletions
+2
-0
EmbedsMany.php
src/Jenssegers/Mongodb/Relations/EmbedsMany.php
+1
-0
RelationsTest.php
tests/RelationsTest.php
+1
-0
No files found.
src/Jenssegers/Mongodb/Relations/EmbedsMany.php
View file @
ae621465
...
@@ -487,6 +487,7 @@ class EmbedsMany extends Relation {
...
@@ -487,6 +487,7 @@ class EmbedsMany extends Relation {
// Attatch the parent relation to the embedded model.
// Attatch the parent relation to the embedded model.
$model
->
setRelation
(
$this
->
foreignKey
,
$this
->
parent
);
$model
->
setRelation
(
$this
->
foreignKey
,
$this
->
parent
);
$model
->
setHidden
(
array_merge
(
$model
->
getHidden
(),
array
(
$this
->
foreignKey
)));
$models
[]
=
$model
;
$models
[]
=
$model
;
}
}
...
...
tests/RelationsTest.php
View file @
ae621465
...
@@ -342,6 +342,7 @@ class RelationsTest extends PHPUnit_Framework_TestCase {
...
@@ -342,6 +342,7 @@ class RelationsTest extends PHPUnit_Framework_TestCase {
$this
->
assertInstanceOf
(
'DateTime'
,
$address
->
created_at
);
$this
->
assertInstanceOf
(
'DateTime'
,
$address
->
created_at
);
$this
->
assertInstanceOf
(
'DateTime'
,
$address
->
updated_at
);
$this
->
assertInstanceOf
(
'DateTime'
,
$address
->
updated_at
);
$this
->
assertInstanceOf
(
'User'
,
$address
->
user
);
$this
->
assertInstanceOf
(
'User'
,
$address
->
user
);
$this
->
assertEmpty
(
$address
->
relationsToArray
());
// prevent infinite loop
$user
=
User
::
find
(
$user
->
_id
);
$user
=
User
::
find
(
$user
->
_id
);
$user
->
addresses
()
->
save
(
new
Address
(
array
(
'city'
=>
'Bruxelles'
)));
$user
->
addresses
()
->
save
(
new
Address
(
array
(
'city'
=>
'Bruxelles'
)));
...
...
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