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())
487487
488488 // Attatch the parent relation to the embedded model.
489489 $ model ->setRelation ($ this ->foreignKey , $ this ->parent );
490+ $ model ->setHidden (array_merge ($ model ->getHidden (), array ($ this ->foreignKey )));
490491
491492 $ models [] = $ model ;
492493 }
Original file line number Diff line number Diff line change @@ -342,6 +342,7 @@ public function testEmbedsManySave()
342342 $ this ->assertInstanceOf ('DateTime ' , $ address ->created_at );
343343 $ this ->assertInstanceOf ('DateTime ' , $ address ->updated_at );
344344 $ this ->assertInstanceOf ('User ' , $ address ->user );
345+ $ this ->assertEmpty ($ address ->relationsToArray ()); // prevent infinite loop
345346
346347 $ user = User::find ($ user ->_id );
347348 $ user ->addresses ()->save (new Address (array ('city ' => 'Bruxelles ' )));
You can’t perform that action at this time.
0 commit comments