File tree 2 files changed +7
-1
lines changed
src/Jenssegers/Mongodb/Relations
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ protected function getEmbedded()
233
233
// Get raw attributes to skip relations and accessors.
234
234
$ attributes = $ this ->parent ->getAttributes ();
235
235
236
- $ embedded = isset ($ attributes [$ this ->localKey ]) ? (array ) $ attributes [$ this ->localKey ] : [] ;
236
+ $ embedded = isset ($ attributes [$ this ->localKey ]) ? (array ) $ attributes [$ this ->localKey ] : null ;
237
237
238
238
return $ embedded ;
239
239
}
Original file line number Diff line number Diff line change @@ -505,6 +505,12 @@ public function testEmbedsOneAssociate()
505
505
$ this ->assertEquals ('Mark Doe ' , $ user ->father ->name );
506
506
}
507
507
508
+ public function testEmbedsOneNullAssociation ()
509
+ {
510
+ $ user = User::create ();
511
+ $ this ->assertNull ($ user ->father );
512
+ }
513
+
508
514
public function testEmbedsOneDelete ()
509
515
{
510
516
$ user = User::create (['name ' => 'John Doe ' ]);
You can’t perform that action at this time.
0 commit comments