diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 8a31779f9..a45cb0209 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -116,6 +116,9 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter #[PhonenumberConstraint] private ?PhoneNumber $phonenumber = null; + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '[]', 'jsonb' => true])] + private $notificationFlags = []; + /** * User constructor. */ @@ -613,4 +616,13 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter return $this; } + public function getNotificationFlagData(string $flag): array + { + return $this->notificationFlags[$flag] ?? []; + } + + public function setNotificationFlagData(string $flag, array $data): void + { + $this->notificationFlags[$flag] = $data; + } } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20250610102953.php b/src/Bundle/ChillMainBundle/migrations/Version20250610102953.php new file mode 100644 index 000000000..1aea75863 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20250610102953.php @@ -0,0 +1,29 @@ +addSql(<<<'SQL' + ALTER TABLE users ADD notificationFlags JSONB DEFAULT '[]' NOT NULL + SQL); + } + + public function down(Schema $schema): void + { + $this->addSql(<<<'SQL' + ALTER TABLE users DROP notificationFlags + SQL); + } +}