src/EventSubscriber/DocumentGenerationSubscriber.php line 78

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber;
  3. use App\Entity\ProcesVerval;
  4. use App\Events\EnterpriseDataFetchedEvent;
  5. use App\Service\DocumentGeneratorService;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. use Symfony\Component\EventDispatcher\GenericEvent;
  8. class DocumentGenerationSubscriber implements EventSubscriberInterface
  9. {
  10.     private DocumentGeneratorService $documentGenerator;
  11.     public function __construct(DocumentGeneratorService $documentGenerator)
  12.     {
  13.         $this->documentGenerator $documentGenerator;
  14.     }
  15.     public static function getSubscribedEvents(): array
  16.     {
  17.         return [
  18.             EnterpriseDataFetchedEvent::DOCUMENT_PV_EVENT => [
  19.                 ['prepareDocumentRegeneration'110],
  20.                 ['createDocumentsDeclarationConfidentialite'100],
  21.                 ['createDocumentsResultatAssembleGenerale'90],
  22.                 ['createDocumentsPouvoir'80],
  23.                 ['createDocumentsEnvoieMailAuClient'70],
  24.                 ['createDocumentsFeuillePresenceAssembleGeneral'60],
  25.                 ['createDocumentsTableauRecapulatif'50],
  26.                 ['createDocumentAttestationConformite'40],
  27.                 ['createDocumentDelegationPouvoirComptes'30],
  28.                 ['createDocumentProcesVerbalAGO'20],
  29.                 ['createDocumentNoteAudit'19],
  30.                 ['createDocumentRapportGestion'18],
  31.                 ['createDocumentRapportSpecialPresident'17],
  32.                 ['createDocumentLettreAccompagnementApprobation'16],
  33.                 ['createDocumentLettreGreffeDepotComptes'15],
  34.             ]
  35.         ];
  36.     }
  37.     public function createDocumentsDeclarationConfidentialite(GenericEvent $event): void
  38.     {
  39.         $this->generate($eventProcesVerval::DOCUMENT_CONFIDENTIALITE);
  40.     }
  41.     public function createDocumentsResultatAssembleGenerale(GenericEvent $event): void
  42.     {
  43.         $this->generate($eventProcesVerval::DOCUMENT_RESULTAT_AG);
  44.     }
  45.     public function createDocumentsPouvoir(GenericEvent $event): void
  46.     {
  47.         $this->generate($eventProcesVerval::DOCUMENT_POUVOIR);
  48.     }
  49.     public function createDocumentsEnvoieMailAuClient(GenericEvent $event): void
  50.     {
  51.         $this->generate($eventProcesVerval::DOCUMENT_ENVOI_MAIL_CLIENT);
  52.     }
  53.     public function createDocumentsFeuillePresenceAssembleGeneral(GenericEvent $event): void
  54.     {
  55.         $this->generate($eventProcesVerval::DOCUMENT_PRESENCE_AG);
  56.     }
  57.     public function createDocumentsTableauRecapulatif(GenericEvent $event): void
  58.     {
  59.         $this->generate($eventProcesVerval::DOCUMENT_RECAPITULATIF);
  60.     }
  61.     public function createDocumentAttestationConformite(GenericEvent $event): void
  62.     {
  63.         $this->generate($eventProcesVerval::DOCUMENT_ACCEPTEMENT_CONFORMITE);
  64.     }
  65.     public function createDocumentDelegationPouvoirComptes(GenericEvent $event): void
  66.     {
  67.         $this->generate($eventProcesVerval::DOCUMENT_DELEGATION_POUVOIR_COMPTES);
  68.     }
  69.     public function createDocumentProcesVerbalAGO(GenericEvent $event): void
  70.     {
  71.         $this->generate($eventProcesVerval::DOCUMENT_PV_AGO);
  72.     }
  73.     public function createDocumentNoteAudit(GenericEvent $event): void
  74.     {
  75.         $this->generate($eventProcesVerval::DOCUMENT_NOTE_AUDIT);
  76.     }
  77.     public function createDocumentRapportGestion(GenericEvent $event): void
  78.     {
  79.         $this->generate($eventProcesVerval::DOCUMENT_RAPPORT_GESTION);
  80.     }
  81.     public function createDocumentRapportSpecialPresident(GenericEvent $event): void
  82.     {
  83.         $this->generate($eventProcesVerval::DOCUMENT_RAPPORT_SPECIAL_PRESIDENT);
  84.     }
  85.     public function createDocumentLettreAccompagnementApprobation(GenericEvent $event): void
  86.     {
  87.         $this->generate($eventProcesVerval::DOCUMENT_LETTRE_ACCOMPAGNEMENT_APPROBATION);
  88.     }
  89.     public function createDocumentLettreGreffeDepotComptes(GenericEvent $event): void
  90.     {
  91.         $this->generate($eventProcesVerval::DOCUMENT_LETTRE_GREFFE_DEPOT_COMPTES);
  92.     }
  93.     public function prepareDocumentRegeneration(GenericEvent $event): void
  94.     {
  95.         $pv $event->getSubject();
  96.         $this->documentGenerator->deleteExistingDocuments($pv);
  97.     }
  98.     private function generate(GenericEvent $eventstring $documentType): void
  99.     {
  100.         $pv $event->getSubject();
  101.         $this->documentGenerator->generateDocuments($pv$documentType);
  102.     }
  103. }