From ed6a940ed41bcabccff812bf83e31296e3cdd31b Mon Sep 17 00:00:00 2001
From: Jonas Leder <jonas.leder@jobrouter.com>
Date: Fri, 25 Nov 2022 10:00:47 +0100
Subject: [PATCH] add name field to user

---
 migrations/Version20221125085936.php | 31 ++++++++++++++++++++++++++++
 src/Entity/Users.php                 | 15 ++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 migrations/Version20221125085936.php

diff --git a/migrations/Version20221125085936.php b/migrations/Version20221125085936.php
new file mode 100644
index 0000000..6435e1e
--- /dev/null
+++ b/migrations/Version20221125085936.php
@@ -0,0 +1,31 @@
+<?php
+
+declare(strict_types=1);
+
+namespace DoctrineMigrations;
+
+use Doctrine\DBAL\Schema\Schema;
+use Doctrine\Migrations\AbstractMigration;
+
+/**
+ * Auto-generated Migration: Please modify to your needs!
+ */
+final class Version20221125085936 extends AbstractMigration
+{
+    public function getDescription(): string
+    {
+        return '';
+    }
+
+    public function up(Schema $schema): void
+    {
+        // this up() migration is auto-generated, please modify it to your needs
+        $this->addSql('ALTER TABLE users ADD name 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 users DROP name');
+    }
+}
diff --git a/src/Entity/Users.php b/src/Entity/Users.php
index 7a7a6a9..9f36f8e 100644
--- a/src/Entity/Users.php
+++ b/src/Entity/Users.php
@@ -29,6 +29,9 @@ class Users implements  UserInterface, PasswordAuthenticatedUserInterface
     #[ORM\ManyToMany(targetEntity: WebResetter::class, inversedBy: 'users')]
     private Collection $webResetter;
 
+    #[ORM\Column(length: 255, nullable: true)]
+    private ?string $name = null;
+
     public function __construct()
     {
         $this->webResetter = new ArrayCollection();
@@ -116,4 +119,16 @@ class Users implements  UserInterface, PasswordAuthenticatedUserInterface
 
         return $this;
     }
+
+    public function getName(): ?string
+    {
+        return $this->name;
+    }
+
+    public function setName(?string $name): self
+    {
+        $this->name = $name;
+
+        return $this;
+    }
 }
-- 
GitLab