vuex-orm / plugin-change-flags

Vuex ORM plugin for adding IsDirty / IsNew flags to model entities.
MIT License
24 stars 10 forks source link

createNew naming convention #3

Closed oliviermilla closed 5 years ago

oliviermilla commented 5 years ago

Vuex-ORM differentiates Models create and insert.

I would say it is wise to respect that convention in the plugin-change-flags API as far as API coherence is concerned.

tvillaren commented 5 years ago

Hello @muichkine,

createNew is an addition to the initial API, thus its different name.

oliviermilla commented 5 years ago

Yes but the API seems different.

For instance. Model.create() in Vuex can take a { data: { key: value }} as an argument while createNew seems not to.

For instance, when doing

 DocumentPrice.createNew({
        data: { DocDataId: 13 }
      }).then((entities) => { console.log(entities); });

the console output shows a DocDataId set to null which is puzzling me.

image

Now doing

 DocumentPrice.create({
        data: { DocDataId: 13 }
      }).then((entities) => { console.log(entities); });

yields

image