laravel-streams / streams-core

Streams is an open-source web application engine for Laravel.
https://streams.dev
Other
169 stars 99 forks source link

Fixed null versionable_id + double versions on create #707

Closed Eighke closed 3 years ago

Eighke commented 3 years ago

2 issues:

The version handle is dispatched before the form, so on create the entry has no id yet.

$this->dispatchNow(new HandleVersioning($this->builder));
$this->dispatchNow(new HandleForm($this->builder));
Column 'versionable_id' cannot be null

By switching the handles it's fix the problem.


Secondly, we create 2 versions on create (but not on update)

https://media.discordapp.net/attachments/748585596645015672/754694343142539275/Screenshot.png

The second come from \Anomaly\Streams\Platform\Entry\EntryObserver::saved. It's because $entry->create(), will create a new different object, so versioningDisabled is resetted.

Screenshot

I used ->fill()->save() instead. I'm just not sure about the observers (looks good for me).