瀏覽代碼

correctif sur les types de numéro de téléphone

garthh 21 小時之前
父節點
當前提交
8f7dad69aa
共有 3 個文件被更改,包括 37 次插入6 次删除
  1. 31 0
      migrations/Version20250805094831.php
  2. 1 2
      src/Controller/ParticipationController.php
  3. 5 4
      src/Entity/Participation.php

+ 31 - 0
migrations/Version20250805094831.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 Version20250805094831 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 participation CHANGE participant_phone participant_phone 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 participation CHANGE participant_phone participant_phone VARCHAR(35) DEFAULT NULL COMMENT \'(DC2Type:phone_number)\'');
+    }
+}

+ 1 - 2
src/Controller/ParticipationController.php

@@ -80,8 +80,7 @@ final class ParticipationController extends AbstractController
         if ($user) {
             $participation->setParticipantName($user->getFullName());
             $participation->setParticipantEmail($user->getEmail());
-            // @todo: réger le problème des type téléphone dans user et gamemaster !
-            // $participation->setParticipantPhone($user->getPhone()); 
+            $participation->setParticipantPhone($user->getPhone()); 
         }
         
         $form = $this->createForm(ParticipationType::class, $participation);

+ 5 - 4
src/Entity/Participation.php

@@ -28,8 +28,9 @@ class Participation
     #[ORM\Column(length: 255)]
     private ?string $participantEmail = null;
 
-    #[ORM\Column(type: 'phone_number', nullable: true)]
-    private ?PhoneNumber $participantPhone = null;
+    #[MisdAssert\PhoneNumber()]
+    #[ORM\Column(length: 255, nullable: true)]
+    private ?string $participantPhone = null;
 
     #[ORM\Column(nullable: true)]
     private ?bool $consentMail = null;
@@ -85,12 +86,12 @@ class Participation
         return $this;
     }
 
-    public function getParticipantPhone(): ?PhoneNumber
+    public function getParticipantPhone(): ?string
     {
         return $this->participantPhone;
     }
 
-    public function setParticipantPhone(?PhoneNumber $participantPhone): static
+    public function setParticipantPhone(?string $participantPhone): static
     {
         $this->participantPhone = $participantPhone;