浏览代码

add missing default fields to AbstractReport

Olivier Massot 2 年之前
父节点
当前提交
62a7850349

+ 51 - 1
src/Entity/Message/AbstractReport.php

@@ -6,6 +6,7 @@ namespace App\Entity\Message;
 use App\Entity\Access\Access;
 use App\Entity\Organization\Organization;
 use App\Enum\Message\ReportMessageStatusEnum;
+use Doctrine\DBAL\Types\Types;
 use Symfony\Component\Validator\Constraints as Assert;
 use Doctrine\ORM\Mapping as ORM;
 
@@ -28,6 +29,19 @@ class AbstractReport
     #[ORM\ManyToOne(inversedBy: 'report')]
     protected ?Organization $organization;
 
+    /**
+     * @deprecated Ne sert qu'à la rétrocompatibilité avec la V1, pourra être supprimé une fois la migration terminée
+     * @var string
+     */
+    #[ORM\Column(length: 255)]
+    private string $recipientType = '(ap2i)';
+
+    /**
+     * @deprecated Ne sert qu'à la rétrocompatibilité avec la V1, pourra être supprimé une fois la migration terminée
+     */
+    #[ORM\Column(type: Types::INTEGER)]
+    private int $recipientId = 0;
+
     public function getDateSend(): ?\DatetimeInterface
     {
         return $this->dateSend;
@@ -71,4 +85,40 @@ class AbstractReport
         $this->organization = $organization;
         return $this;
     }
-}
+
+    /**
+     * @deprecated Ne sert qu'à la rétrocompatibilité avec la V1, pourra être supprimé une fois la migration terminée
+     * @return string
+     */
+    public function getRecipientType(): string
+    {
+        return $this->recipientType;
+    }
+
+    /**
+     * @deprecated Ne sert qu'à la rétrocompatibilité avec la V1, pourra être supprimé une fois la migration terminée
+     * @param string $recipientType
+     */
+    public function setRecipientType(string $recipientType): void
+    {
+        $this->recipientType = $recipientType;
+    }
+
+    /**
+     * @deprecated Ne sert qu'à la rétrocompatibilité avec la V1, pourra être supprimé une fois la migration terminée
+     * @return int
+     */
+    public function getRecipientId(): int
+    {
+        return $this->recipientId;
+    }
+
+    /**
+     * @deprecated Ne sert qu'à la rétrocompatibilité avec la V1, pourra être supprimé une fois la migration terminée
+     * @param int $recipientId
+     */
+    public function setRecipientId(int $recipientId): void
+    {
+        $this->recipientId = $recipientId;
+    }
+}

+ 4 - 1
src/Service/Mailer/Mailer.php

@@ -49,7 +49,10 @@ class Mailer
      * @throws TransportExceptionInterface
      * @see MailerTest::testMain()
      */
-    public function main(MailerModelInterface $mailerModel): ArrayCollection{
+    public function main(MailerModelInterface $mailerModel): ArrayCollection {
+        // TODO: est-ce qu'on l'appellerait pas plutôt 'send' celle-ci? et est-ce qu'on ne passerait pas les autres en
+        //       private? j'ai peur qu'on se trompe parfois entre l'une et l'autre
+
         $builderService = $this->builderIterator->getBuilderFor($mailerModel);
         $emailsCollection = $builderService->build($mailerModel);
 

+ 1 - 1
src/Service/OnChange/Organization/OnSubdomainChange.php

@@ -62,7 +62,7 @@ class OnSubdomainChange extends OnChangeDefault
         // A new subdomain is active
         // /!\ This has to be executed after everything has been persisted
         if ($subdomain->isActive() && !($context->previousData() && $context->previousData()->isActive())) {
-            // TODO: comprendre pourquoi ce refresh est indispensable pour le l'organisation soit à jour
+            // TODO: comprendre pourquoi ce refresh est indispensable pour que l'organisation soit à jour
             $this->em->refresh($subdomain->getOrganization());
 
             // Update the typo3 website (asynchronously with messenger)