From f0127cd68b8b002bd145b4bcf8f20c3bf687b87f Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Mon, 10 Aug 2020 15:58:04 +0200 Subject: [PATCH] Add column that enables/disables the form [MAILPOET-3075] --- lib/Config/Migrator.php | 2 ++ lib/Entities/FormEntity.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/Config/Migrator.php b/lib/Config/Migrator.php index b62d929d52..048fb340bd 100644 --- a/lib/Config/Migrator.php +++ b/lib/Config/Migrator.php @@ -2,6 +2,7 @@ namespace MailPoet\Config; +use MailPoet\Entities\FormEntity; use MailPoet\Models\Newsletter; use MailPoet\Models\Subscriber; use MailPoet\Settings\SettingsController; @@ -385,6 +386,7 @@ class Migrator { $attributes = [ 'id int(11) unsigned NOT NULL AUTO_INCREMENT,', 'name varchar(90) NOT NULL,', // should be null but db_delta can't handle this change + 'status varchar(20) NOT NULL DEFAULT "' . FormEntity::STATUS_ENABLED . '",', 'body longtext,', 'settings longtext,', 'styles longtext,', diff --git a/lib/Entities/FormEntity.php b/lib/Entities/FormEntity.php index 24ab230836..79327da12c 100644 --- a/lib/Entities/FormEntity.php +++ b/lib/Entities/FormEntity.php @@ -24,6 +24,9 @@ class FormEntity { const DISPLAY_TYPE_SLIDE_IN = 'slide_in'; const DISPLAY_TYPE_OTHERS = 'others'; + const STATUS_ENABLED = 'enabled'; + const STATUS_DISABLED = 'disabled'; + /** * @ORM\Column(type="string") * @var string @@ -36,6 +39,12 @@ class FormEntity { */ private $body; + /** + * @ORM\Column(type="string") + * @var string + */ + private $status; + /** * @ORM\Column(type="serialized_array") * @var array|null @@ -50,6 +59,7 @@ class FormEntity { public function __construct($name) { $this->name = $name; + $this->status = self::STATUS_ENABLED; } /**