From 4b95d0ae473c076a4e71bee8aafa9db010c73827 Mon Sep 17 00:00:00 2001 From: Basil Suter Date: Wed, 5 Oct 2022 07:53:59 +0000 Subject: [PATCH 1/2] allow delete and cleanup data --- src/models/Form.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/models/Form.php b/src/models/Form.php index ce51d6d..b27678a 100644 --- a/src/models/Form.php +++ b/src/models/Form.php @@ -23,7 +23,7 @@ * @property integer $updated_at * @property integer $created_by * @property integer $updated_by - * + * @property Submission[] $submissions * @author Basil Suter * @since 1.0.0 */ @@ -61,6 +61,19 @@ public function behaviors() ]; } + /** + * {@inheritDoc} + */ + public function init() + { + parent::init(); + $this->on(self::EVENT_AFTER_DELETE, function() { + foreach ($this->submissions as $submission) { + $submission->delete(); + } + }); + } + /** * @inheritdoc */ @@ -131,7 +144,7 @@ public function ngRestScopes() return [ ['list', ['title', 'recipients']], [['create', 'update'], ['title', 'recipients', 'subject', 'copy_to_attribute', 'email_intro', 'email_outro']], - ['delete', false], + ['delete', true], ]; } From 7e9ef1ed219a5a10a216652889cf16c61a6ae905 Mon Sep 17 00:00:00 2001 From: Basil Suter Date: Wed, 5 Oct 2022 07:54:41 +0000 Subject: [PATCH 2/2] enable delete button --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbcf107..7e2d1e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). In order to read more about upgrading and BC breaks have a look at the [UPGRADE Document](UPGRADE.md). +## 1.7.1 (5. October 2022) + ++ [#30](https://github.com/luyadev/luya-module-forms/pull/30) Added option to delete forms including all values and submissions. + ## 1.7.0 (1. September 2022) + [#29](https://github.com/luyadev/luya-module-forms/pull/29) Added option to retrieve certain value in submission email object.