File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
src/Jenssegers/Mongodb/Relations Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ protected function getEmbedded()
217217 $ attributes = $ this ->parent ->getAttributes ();
218218
219219 // Get embedded models form parent attributes.
220- $ embedded = isset ($ attributes [$ this ->localKey ]) ? (array ) $ attributes [$ this ->localKey ] : [] ;
220+ $ embedded = isset ($ attributes [$ this ->localKey ]) ? (array ) $ attributes [$ this ->localKey ] : null ;
221221
222222 return $ embedded ;
223223 }
Original file line number Diff line number Diff line change @@ -506,6 +506,12 @@ public function testEmbedsOneAssociate()
506506 $ this ->assertEquals ('Mark Doe ' , $ user ->father ->name );
507507 }
508508
509+ public function testEmbedsOneNullAssociation ()
510+ {
511+ $ user = User::create ();
512+ $ this ->assertNull ($ user ->father );
513+ }
514+
509515 public function testEmbedsOneDelete ()
510516 {
511517 $ user = User::create (['name ' => 'John Doe ' ]);
You can’t perform that action at this time.
0 commit comments