File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
src/Jenssegers/Mongodb/Relations Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -163,9 +163,9 @@ public function save(Model $model)
163163 protected function performInsert (Model $ model )
164164 {
165165 // Create a new key.
166- if (!$ model-> getKey ( ))
166+ if (!isset ( $ model[ ' _id ' ] ))
167167 {
168- $ model ->setAttribute ($ model -> getKeyName () , new MongoId );
168+ $ model ->setAttribute (' _id ' , new MongoId );
169169 }
170170
171171 // Set timestamps.
Original file line number Diff line number Diff line change @@ -292,6 +292,7 @@ public function testEmbedsManySave()
292292 $ this ->assertEquals (array ('London ' ), $ user ->addresses ->lists ('city ' ));
293293 $ this ->assertInstanceOf ('DateTime ' , $ address ->created_at );
294294 $ this ->assertInstanceOf ('DateTime ' , $ address ->updated_at );
295+ $ this ->assertNotNull ($ address ->_id );
295296
296297 $ address = $ user ->addresses ()->save (new Address (array ('city ' => 'Paris ' )));
297298
You can’t perform that action at this time.
0 commit comments