Browse Source

fix/refactoring after MR

Vincent GUFFON 3 years ago
parent
commit
5dc09bf119

+ 0 - 1
src/Entity/Organization/OrganizationArticle.php

@@ -89,7 +89,6 @@ class OrganizationArticle
     }
 
     public function setDate(?\DateTime $date = null): self {
-        if($date == null) $date = new \DateTime();
         $this->date = $date;
         return $this;
     }

+ 1 - 1
src/EventListener/Helper.php

@@ -7,7 +7,7 @@ use Doctrine\ORM\EntityManagerInterface;
 
 
 /**
- * Classe ... qui ...
+ * Trait Helper qui met à disposition des fonctions d'aide pour les EventListeners
  */
 trait Helper
 {

+ 3 - 3
src/EventListener/Organization/OrganizationChangedSubscriber.php

@@ -40,7 +40,7 @@ class OrganizationChangedSubscriber implements EventSubscriberInterface
         $uow = $entityManager->getUnitOfWork();
         foreach ($uow->getScheduledEntityUpdates() as $entityUpdate){
             if($entityUpdate instanceof Organization){
-                //Si un update du field legalStatus est modifié
+                //Si dans l'update de l'entité, on modifie le champs "legalStatus"
                 if($this->hasChangeField($entityManager, $entityUpdate, 'legalStatus'))
                     $this->handleLegalStatusChanged($entityUpdate, $entityManager);
             }
@@ -53,13 +53,13 @@ class OrganizationChangedSubscriber implements EventSubscriberInterface
      * @param EntityManagerInterface $entityManager
      */
     public function handleLegalStatusChanged(Organization $organization, EntityManagerInterface $entityManager){
-        //Si le status légal n'est pas "Association Loi 1901"
+        //Si le nouveau status légal n'est pas "Association Loi 1901"
         if($organization->getLegalStatus() !== LegalEnum::ASSOCIATION_LAW_1901()->getValue()){
             $organization->getParameters()->setShowAdherentList(false);
             $entityManager->getUnitOfWork()->computeChangeSet($entityManager->getClassMetadata(Parameters::class), $organization->getParameters());
         }
 
-        //Si le status légal est "Société commerciale"
+        //Si le nouveau status légal est "Société commerciale"
         if($organization->getLegalStatus() === LegalEnum::COMMERCIAL_SOCIETY()->getValue()){
             $organization->getBillingSetting()->setApplyVat(true);
             $entityManager->getUnitOfWork()->computeChangeSet($entityManager->getClassMetadata(BillingSetting::class), $organization->getBillingSetting());