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)
163
163
protected function performInsert (Model $ model )
164
164
{
165
165
// Create a new key.
166
- if (!$ model-> getKey ( ))
166
+ if (!isset ( $ model[ ' _id ' ] ))
167
167
{
168
- $ model ->setAttribute ($ model -> getKeyName () , new MongoId );
168
+ $ model ->setAttribute (' _id ' , new MongoId );
169
169
}
170
170
171
171
// Set timestamps.
Original file line number Diff line number Diff line change @@ -292,6 +292,7 @@ public function testEmbedsManySave()
292
292
$ this ->assertEquals (array ('London ' ), $ user ->addresses ->lists ('city ' ));
293
293
$ this ->assertInstanceOf ('DateTime ' , $ address ->created_at );
294
294
$ this ->assertInstanceOf ('DateTime ' , $ address ->updated_at );
295
+ $ this ->assertNotNull ($ address ->_id );
295
296
296
297
$ address = $ user ->addresses ()->save (new Address (array ('city ' => 'Paris ' )));
297
298
You can’t perform that action at this time.
0 commit comments