File tree Expand file tree Collapse file tree 2 files changed +2
-0
lines changed
src/Jenssegers/Mongodb/Relations Expand file tree Collapse file tree 2 files changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -487,6 +487,7 @@ protected function toCollection(array $results = array())
487
487
488
488
// Attatch the parent relation to the embedded model.
489
489
$ model ->setRelation ($ this ->foreignKey , $ this ->parent );
490
+ $ model ->setHidden (array_merge ($ model ->getHidden (), array ($ this ->foreignKey )));
490
491
491
492
$ models [] = $ model ;
492
493
}
Original file line number Diff line number Diff line change @@ -342,6 +342,7 @@ public function testEmbedsManySave()
342
342
$ this ->assertInstanceOf ('DateTime ' , $ address ->created_at );
343
343
$ this ->assertInstanceOf ('DateTime ' , $ address ->updated_at );
344
344
$ this ->assertInstanceOf ('User ' , $ address ->user );
345
+ $ this ->assertEmpty ($ address ->relationsToArray ()); // prevent infinite loop
345
346
346
347
$ user = User::find ($ user ->_id );
347
348
$ user ->addresses ()->save (new Address (array ('city ' => 'Bruxelles ' )));
You can’t perform that action at this time.
0 commit comments