From 0cf373303a4642aaa9d2c92e8d83aa299c924c0f Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Tue, 4 Mar 2025 12:53:05 +0100 Subject: [PATCH] Updated migrations --- migrations/Version20250304115209.php | 31 ++++++++++++++++++++++++++++ src/Dto/Output/UserOutput.php | 2 +- src/Entity/User.php | 4 ++-- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 migrations/Version20250304115209.php diff --git a/migrations/Version20250304115209.php b/migrations/Version20250304115209.php new file mode 100644 index 0000000..32f12dc --- /dev/null +++ b/migrations/Version20250304115209.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE user CHANGE groups_view groups_view VARCHAR(255) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE user CHANGE groups_view groups_view VARCHAR(255) NOT NULL'); + } +} diff --git a/src/Dto/Output/UserOutput.php b/src/Dto/Output/UserOutput.php index cdab043..afa038f 100644 --- a/src/Dto/Output/UserOutput.php +++ b/src/Dto/Output/UserOutput.php @@ -24,7 +24,7 @@ final class UserOutput extends AbstractOutput #[Groups(['user:read'])] public array $userGroups; #[Groups(['user:read'])] - public string $groupsView; + public ?string $groupsView = 'card'; #[Groups(['user:read'])] public \DateTime $createdAt; diff --git a/src/Entity/User.php b/src/Entity/User.php index 984b0e9..809ea75 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -51,7 +51,7 @@ class User extends AbstractEntity implements UserInterface, PasswordAuthenticate private ?string $newPassword = null; private ?string $repeatNewPassword = null; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] private ?string $groupsView = null; @@ -254,7 +254,7 @@ class User extends AbstractEntity implements UserInterface, PasswordAuthenticate return $this->groupsView; } - public function setGroupsView(string $groupsView): static + public function setGroupsView(?string $groupsView): static { $this->groupsView = $groupsView;