From 1c426f560e900151eb2a700a4e71d63606f77935 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 10 Jun 2025 12:27:38 +0200 Subject: [PATCH] Add flags property to Notification entity + migraiton --- .../ChillMainBundle/Entity/Notification.php | 15 ++++++++++ .../migrations/Version20250610102020.php | 30 +++++++++++++++++++ symfony.lock | 9 ++++++ 3 files changed, 54 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20250610102020.php diff --git a/src/Bundle/ChillMainBundle/Entity/Notification.php b/src/Bundle/ChillMainBundle/Entity/Notification.php index 9f08e0487..425f1e47c 100644 --- a/src/Bundle/ChillMainBundle/Entity/Notification.php +++ b/src/Bundle/ChillMainBundle/Entity/Notification.php @@ -100,6 +100,9 @@ class Notification implements TrackUpdateInterface #[ORM\ManyToOne(targetEntity: User::class)] private ?User $updatedBy = null; + #[ORM\Column(name: 'flags', type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '[]', 'jsonb' => true])] + private $flags = []; + public function __construct() { $this->addressees = new ArrayCollection(); @@ -389,4 +392,16 @@ class Notification implements TrackUpdateInterface return $this; } + + public function setFlags(array $flags = []): self + { + $this->flags = $flags; + + return $this; + } + + public function getFlags(): array + { + return $this->flags; + } } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20250610102020.php b/src/Bundle/ChillMainBundle/migrations/Version20250610102020.php new file mode 100644 index 000000000..ad029f177 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20250610102020.php @@ -0,0 +1,30 @@ +addSql(<<<'SQL' + ALTER TABLE chill_main_notification ADD flags JSONB DEFAULT '[]' NOT NULL + SQL); + } + + public function down(Schema $schema): void + { + $this->addSql(<<<'SQL' + ALTER TABLE chill_main_notification DROP flags + SQL); + } +} diff --git a/symfony.lock b/symfony.lock index ee44b19d8..6409f0c1d 100644 --- a/symfony.lock +++ b/symfony.lock @@ -14,6 +14,15 @@ "config/routes/annotations.yaml" ] }, + "doctrine/deprecations": { + "version": "1.1", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.0", + "ref": "87424683adc81d7dc305eefec1fced883084aab9" + } + }, "doctrine/doctrine-bundle": { "version": "2.13", "recipe": {