src/View/EditMask.php
private function storeVersion(ModelInterface $model)
    {
        if (!$this->modelProvider->isVersioningEnabled()) {
            return;
        }

        $environment    = $this->environment;
        $modelId        = $model->getId();
        $dataProvider   = $environment->getDataProvider($this->model->getProviderName());
        $currentVersion = $dataProvider->getActiveVersion($modelId);
        // Compare version and current record.
        if (!$currentVersion
            || !$dataProvider->sameModels($model, $dataProvider->getVersion($modelId, $currentVersion))
        ) {
            $user     = \FrontendUser::getInstance();
            $username = '(frontend anonymous)';
            if ($user->authenticate()) {
                $username = $user->username;
            }

            $dataProvider->saveVersion($model, $username);
        }
    }
private function storeVersion(ModelInterface $model)
    {
        if (!$this->modelProvider->isVersioningEnabled()) {
            return;
        }

        $environment    = $this->environment;
        $modelId        = $model->getId();
        $dataProvider   = $environment->getDataProvider($this->model->getProviderName());
        $currentVersion = $dataProvider->getActiveVersion($modelId);
        // Compare version and current record.
        if (!$currentVersion
            || !$dataProvider->sameModels($model, $dataProvider->getVersion($modelId, $currentVersion))
        ) {
            $user     = \FrontendUser::getInstance();
            $username = '(frontend anonymous)';
            if ($user->authenticate()) {
                $username = $user->username;
            }

            $dataProvider->saveVersion($model, $username);
        }
    }
Update the versioning information in the data provider for a given model (if necessary).

@param ModelInterface $model The model to update.

@return void