| @@ -2,17 +2,20 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace BitCode\BitForm\Core\Migration; |
| 4 | 4 | |
| 5 | 5 | // create class for migration |
| 6 | -final class Migration { | |
| 6 | +final class Migration | |
| 7 | +{ | |
| 7 | 8 | private $_formData; |
| 8 | 9 | |
| 9 | - public function __construct($data) { | |
| 10 | + public function __construct($data) | |
| 11 | + { | |
| 10 | 12 | $this->_formData = $data; |
| 11 | 13 | } |
| 12 | 14 | |
| 13 | 15 | // create function for migration |
| 14 | - public function migrate() { | |
| 16 | + public function migrate() | |
| 17 | + { | |
| 15 | 18 | $formData = $this->_formData; |
| 16 | 19 | |
| 17 | 20 | $formData->form_content = self::convertFormContent($formData->form_content); |
| 18 | 21 | $formData->workFlows = WorkFlows::migrate($formData->workFlows); |
| @@ -19,9 +22,10 @@ | ||
| 19 | 22 | $formData->formSettings = self::convertFormSettings($formData->formSettings); |
| 20 | 23 | return $formData; |
| 21 | 24 | } |
| 22 | 25 | |
| 23 | - public function convertFormContent($formContentV1) { | |
| 26 | + public function convertFormContent($formContentV1) | |
| 27 | + { | |
| 24 | 28 | $formContenV2 = $formContentV1; |
| 25 | 29 | |
| 26 | 30 | if (isset($formContentV1->fields)) { |
| 27 | 31 | $formContenV2->fields = MigrationHelper::convertFields($formContentV1->fields); |
| @@ -32,12 +36,16 @@ | ||
| 32 | 36 | |
| 33 | 37 | return $formContenV2; |
| 34 | 38 | } |
| 35 | 39 | |
| 36 | - public function convertFormSettings($formSettingsV1) { | |
| 40 | + public function convertFormSettings($formSettingsV1) | |
| 41 | + { | |
| 37 | 42 | $formSettingsV2 = $formSettingsV1; |
| 38 | 43 | if (isset($formSettingsV1->confirmation->type->successMsg)) { |
| 39 | 44 | $formSettingsV2->confirmation->type->successMsg = MigrationHelper::convertSuccessMessage($formSettingsV1->confirmation->type->successMsg); |
| 45 | + } | |
| 46 | + if (!empty($formSettingsV1->confirmation->type->webHooks)) { | |
| 47 | + $formSettingsV2->integrations = MigrationHelper::convertWebHooksToIntegrations($formSettingsV1); | |
| 40 | 48 | } |
| 41 | 49 | return $formSettingsV2; |
| 42 | 50 | } |
| 43 | 51 | } |