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;