From b4ff119031a41b7bd0000408013e9b3e9d79f148 Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Tue, 18 Aug 2026 09:55:51 +0300 Subject: [PATCH] Fix cascading deletes for Petitions by declaring HistoricPetitionViewers Entry Point Model and plugin relations --- .../HistoricPetitionViewer/config/plugin.json | 6 +++++- .../Model/Table/HistoricPetitionViewersTable.php | 13 ++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/availableplugins/HistoricPetitionViewer/config/plugin.json b/app/availableplugins/HistoricPetitionViewer/config/plugin.json index f7a8a1ca7..1f0806f1c 100644 --- a/app/availableplugins/HistoricPetitionViewer/config/plugin.json +++ b/app/availableplugins/HistoricPetitionViewer/config/plugin.json @@ -1,5 +1,9 @@ { - "types": {}, + "types": { + "enrollment_flow_step": [ + "HistoricPetitionViewers" + ] + }, "schema": { "tables": { "petition_hist_attrs": { diff --git a/app/availableplugins/HistoricPetitionViewer/src/Model/Table/HistoricPetitionViewersTable.php b/app/availableplugins/HistoricPetitionViewer/src/Model/Table/HistoricPetitionViewersTable.php index 3aedb0182..d9d52f67a 100644 --- a/app/availableplugins/HistoricPetitionViewer/src/Model/Table/HistoricPetitionViewersTable.php +++ b/app/availableplugins/HistoricPetitionViewer/src/Model/Table/HistoricPetitionViewersTable.php @@ -52,7 +52,18 @@ public function initialize(array $config): void { $this->setTableType(TableTypeEnum::Configuration); // Define associations - $this->belongsTo('EnrollmnetFlowSteps'); + $this->belongsTo('EnrollmentFlowSteps'); + + $this->hasManyPlugins([ + 'Petitions' => [ + [ + 'targetModel' => 'HistoricPetitionViewer.HistoricPetitionAttributes' + ], + [ + 'targetModel' => 'HistoricPetitionViewer.HistoricPetitionMetadataRecords' + ] + ] + ]); $this->setDisplayField('id');