Closed TimFoerster closed 1 year ago
All entries are also stored twice?
All entries are also stored twice?
Both listen to the same events, therefore it will be stored twice.
Revisionable:
public function initializeRevisionable()
{
if (!is_array($this->revisionable)) {
throw new Exception(sprintf(
'The $revisionable property in %s must be an array to use the Revisionable trait.',
get_class($this)
));
}
$this->bindEvent('model.afterUpdate', function () {
$this->revisionableAfterUpdate();
});
$this->bindEvent('model.afterDelete', function () {
$this->revisionableAfterDelete();
});
}
@TimFoerster Hey, you need to only include trait from this plugin, if you add both traits it will fire 2 times.
This is already the case
use Samuell\Revisions\Traits\Revisions;
class Company extends Model
{
use Revisions;
protected $revisionable = [
'section',
'name',
'address',
'type',
'station_id',
'content',
'contacts',
'divisions',
'persons'
];
...
Error appears only with ocms 3.
@TimFoerster if you remove that bindEvent it works correctly?
I have the same problem. You need to comment this part on your plugin inside revisions/traits/Revisions.php
/* $model->bindEvent('model.afterUpdate', function () use ($model) {
$model->revisionableAfterUpdate();
});
$model->bindEvent('model.afterDelete', function () use ($model) {
$model->revisionableAfterDelete();
});*/
@skacco @TimFoerster Hey, if you can pull master changes and try it out if it works correctly, Thanks!
They have also null values instead of empty arrays. Don't know if that is Ocms v3 related.