Преглед на файлове

fix dependency injection errors

Olivier Massot преди 10 месеца
родител
ревизия
1ed89dc540

+ 5 - 5
config/packages/messenger.yaml

@@ -11,8 +11,8 @@ framework:
 
         routing:
             # Route your messages to the transports
-            'App\Message\Command\MailerCommand': async
-            'App\Message\Command\Export': async
-            'App\Message\Command\Typo3\Typo3UpdateCommand': async
-            'App\Message\Command\Typo3\Typo3DeleteCommand': async
-            'App\Message\Command\Typo3\Typo3UndeleteCommand': async
+            'App\Message\Message\Mailer': async
+            'App\Message\Message\Export': async
+            'App\Message\Message\Typo3\Typo3Update': async
+            'App\Message\Message\Typo3\Typo3Delete': async
+            'App\Message\Message\Typo3\Typo3Undelete': async

+ 2 - 2
src/Message/Handler/MailerHandler.php

@@ -5,7 +5,7 @@ declare(strict_types=1);
 namespace App\Message\Handler;
 
 use App\Entity\Message\Email;
-use App\Message\Message\MailerCommand;
+use App\Message\Message\Mailer as MailerMessage;
 use App\Repository\Access\AccessRepository;
 use App\Service\Mailer\Mailer;
 use App\Service\Notifier;
@@ -21,7 +21,7 @@ class MailerHandler
     ) {
     }
 
-    public function __invoke(MailerCommand $mailerCommand): void
+    public function __invoke(MailerMessage $mailerCommand): void
     {
         $mailerModel = $mailerCommand->getMailerModel();
         $emails = $this->mailer->main($mailerModel);

+ 1 - 1
src/Message/Message/MailerCommand.php → src/Message/Message/Mailer.php

@@ -9,7 +9,7 @@ use App\Service\Mailer\Model\MailerModelInterface;
 /**
  * Classe ... qui ...
  */
-class MailerCommand
+class Mailer
 {
     public function __construct(
         private MailerModelInterface $model,

+ 2 - 2
src/Service/Typo3/SubdomainService.php

@@ -4,7 +4,7 @@ namespace App\Service\Typo3;
 
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\Subdomain;
-use App\Message\Message\MailerCommand;
+use App\Message\Message\Mailer;
 use App\Message\Message\Typo3\Typo3Update;
 use App\Repository\Access\AccessRepository;
 use App\Repository\Organization\SubdomainRepository;
@@ -244,7 +244,7 @@ class SubdomainService
 
         // Envoi d'un email
         $this->messageBus->dispatch(
-            new MailerCommand($model)
+            new Mailer($model)
         );
     }
 }

+ 1 - 1
src/State/Processor/Export/LicenceCmf/ExportRequestProcessor.php

@@ -9,12 +9,12 @@ use ApiPlatform\Metadata\Operation;
 use ApiPlatform\State\ProcessorInterface;
 use App\ApiResources\Export\ExportRequest;
 use App\Entity\Access\Access;
-use App\Entity\Core\File;
 use App\Message\Message\Export;
 use App\Service\ServiceIterator\ExporterIterator;
 use Symfony\Bundle\SecurityBundle\Security;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\Messenger\MessageBusInterface;
+use App\Service\Network\Utils as NetworkUtils;
 
 class ExportRequestProcessor implements ProcessorInterface
 {

+ 3 - 3
tests/Unit/Service/Typo3/SubdomainServiceTest.php

@@ -7,7 +7,7 @@ use App\Entity\Organization\Organization;
 use App\Entity\Organization\Parameters;
 use App\Entity\Organization\Subdomain;
 use App\Entity\Person\Person;
-use App\Message\Message\MailerCommand;
+use App\Message\Message\Mailer;
 use App\Message\Message\Typo3\Typo3Update;
 use App\Repository\Access\AccessRepository;
 use App\Repository\Organization\SubdomainRepository;
@@ -523,8 +523,8 @@ class SubdomainServiceTest extends TestCase
         $this->messageBus
             ->expects(self::once())
             ->method('dispatch')
-            ->with(self::isInstanceOf(MailerCommand::class))
-            ->willReturn(new Envelope(new MailerCommand($subdomainChangeModel)));
+            ->with(self::isInstanceOf(Mailer::class))
+            ->willReturn(new Envelope(new Mailer($subdomainChangeModel)));
 
         $subdomainService->sendConfirmationEmail($subdomain);
     }