Olivier Massot 9 mesi fa
parent
commit
39d82732ea
31 ha cambiato i file con 282 aggiunte e 307 eliminazioni
  1. 6 5
      src/Commands/Doctrine/SchemaValidateCommand.php
  2. 4 4
      src/Entity/Access/Access.php
  3. 2 2
      src/Entity/Billing/AbstractBillAccounting.php
  4. 11 11
      src/Entity/Billing/Afi.php
  5. 18 18
      src/Entity/Billing/BillSchedule.php
  6. 1 0
      src/Entity/Billing/BillingExportSetting.php
  7. 10 10
      src/Entity/Billing/CirilCivil.php
  8. 13 12
      src/Entity/Billing/FamilyQuotientBand.php
  9. 13 12
      src/Entity/Billing/FamilyQuotientBandDetail.php
  10. 13 13
      src/Entity/Billing/FamilyQuotientModel.php
  11. 11 11
      src/Entity/Billing/Odyssee.php
  12. 1 1
      src/Entity/Billing/SddBank.php
  13. 1 1
      src/Entity/Billing/SddRegie.php
  14. 0 2
      src/Entity/Booking/Examen.php
  15. 0 3
      src/Entity/Booking/OrganizationHoliday.php
  16. 0 2
      src/Entity/Booking/PersonHoliday.php
  17. 2 2
      src/Entity/Core/AbstractRepair.php
  18. 1 1
      src/Entity/Core/AddressPostal.php
  19. 3 3
      src/Entity/Core/File.php
  20. 3 3
      src/Entity/Education/EducationCurriculum.php
  21. 22 23
      src/Entity/Education/EducationCurriculumPack.php
  22. 4 4
      src/Entity/Message/AbstractMessage.php
  23. 14 12
      src/Entity/Message/ReportMessage.php
  24. 2 2
      src/Entity/Organization/Organization.php
  25. 3 3
      src/Entity/Person/Person.php
  26. 3 3
      src/Entity/Place/RoomControl.php
  27. 7 7
      src/Entity/Token/Token.php
  28. 6 7
      src/Service/Cron/Job/SchemaValidation.php
  29. 10 6
      src/Service/Doctrine/SchemaValidation/Difference.php
  30. 96 124
      src/Service/Doctrine/SchemaValidation/SchemaSnippetsMaker.php
  31. 2 0
      src/Service/Doctrine/SchemaValidation/SchemaValidationService.php

+ 6 - 5
src/Commands/Doctrine/SchemaValidateCommand.php

@@ -14,7 +14,7 @@ use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
 /**
- * Valide le schéma Doctrine en le comparant à la V1
+ * Valide le schéma Doctrine en le comparant à la V1.
  *
  * @see https://ressources-opentalent.atlassian.net/wiki/spaces/DEV/pages/240551231/V+rifier+le+sch+ma+Doctrine+de+la+V2+et+g+n+rer+les+entit+s+et+propri+t+s+manquantes
  */
@@ -46,7 +46,7 @@ class SchemaValidateCommand extends Command
             'snippets',
             null,
             InputOption::VALUE_NONE,
-            "Make snippets of the missing classes and fields"
+            'Make snippets of the missing classes and fields'
         );
     }
 
@@ -59,7 +59,8 @@ class SchemaValidateCommand extends Command
         $csv = $this->schemaValidationService->formatToCsv($diff);
 
         if (empty($csv)) {
-            $output->writeln("No difference found");
+            $output->writeln('No difference found');
+
             return 0;
         }
 
@@ -67,11 +68,11 @@ class SchemaValidateCommand extends Command
             $output->writeln($line);
         }
 
-        $output->writeln(count($csv) . " differences found");
+        $output->writeln(count($csv).' differences found');
 
         if ($input->getOption('snippets')) {
             $this->schemaSnippetsMaker->makeSnippets($diff);
-            $output->writeln("Snippets generated");
+            $output->writeln('Snippets generated');
         }
 
         return 0;

+ 4 - 4
src/Entity/Access/Access.php

@@ -2292,7 +2292,7 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
     public function removeAccompanistControl(AbstractControl $accompanistControl): self
     {
         if ($this->accompanistControl->removeElement($accompanistControl)) {
-//            $accompanistControl->setAccompanist(null);  // TODO: actuellement, pas nullable: conserver?
+            //            $accompanistControl->setAccompanist(null);  // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;
@@ -2375,7 +2375,7 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this->tokens;
     }
 
-    function addToken(Token $token): self
+    public function addToken(Token $token): self
     {
         if (!$this->tokens->contains($token)) {
             $this->tokens[] = $token;
@@ -2385,10 +2385,10 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this;
     }
 
-    function removeToken(Token $token): self
+    public function removeToken(Token $token): self
     {
         if ($this->tokens->removeElement($token)) {
-//            $token->setAccess(null);  // TODO: actuellement, pas nullable: conserver?
+            //            $token->setAccess(null);  // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;

+ 2 - 2
src/Entity/Billing/AbstractBillAccounting.php

@@ -327,7 +327,7 @@ abstract class AbstractBillAccounting
         return $this->tags;
     }
 
-    function addTag(Tagg $tag): self
+    public function addTag(Tagg $tag): self
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
@@ -337,7 +337,7 @@ abstract class AbstractBillAccounting
         return $this;
     }
 
-    function removeTag(Tagg $tag): self
+    public function removeTag(Tagg $tag): self
     {
         if ($this->tags->removeElement($tag)) {
             $tag->removeBillAccounting($this);

+ 11 - 11
src/Entity/Billing/Afi.php

@@ -5,9 +5,7 @@ declare(strict_types=1);
 namespace App\Entity\Billing;
 
 use ApiPlatform\Metadata\ApiResource;
-use App;
 use App\Entity\Core\File;
-use DateTimeInterface;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
@@ -24,25 +22,26 @@ class Afi
     protected Collection $bills;
 
     #[ORM\OneToOne(targetEntity: File::class, cascade: ['persist'])]
-    protected App\Entity\Core\File $file;
+    protected File $file;
 
-    function getId(): int
+    public function getId(): int
     {
         return $this->id;
     }
 
-    function setId(int $id): self
+    public function setId(int $id): self
     {
         $this->id = $id;
+
         return $this;
     }
 
-    function getBills(): Collection
+    public function getBills(): Collection
     {
         return $this->bills;
     }
 
-    function addBill(Bill $bill): self
+    public function addBill(Bill $bill): self
     {
         if (!$this->bills->contains($bill)) {
             $this->bills[] = $bill;
@@ -52,23 +51,24 @@ class Afi
         return $this;
     }
 
-    function removeBill(Bill $bill): self
+    public function removeBill(Bill $bill): self
     {
         if ($this->bills->removeElement($bill)) {
-//            $bill->setAfi(null);   // TODO: actuellement, pas nullable: conserver?
+            //            $bill->setAfi(null);   // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;
     }
 
-    function getFile(): App\Entity\Core\File
+    public function getFile(): File
     {
         return $this->file;
     }
 
-    function setFile(App\Entity\Core\File $file): self
+    public function setFile(File $file): self
     {
         $this->file = $file;
+
         return $this;
     }
 }

+ 18 - 18
src/Entity/Billing/BillSchedule.php

@@ -5,10 +5,8 @@ declare(strict_types=1);
 namespace App\Entity\Billing;
 
 use ApiPlatform\Metadata\ApiResource;
-use App;
 use App\Entity\AccessWish\AccessWish;
 use App\Entity\Organization\Organization;
-use DateTimeInterface;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
@@ -23,7 +21,7 @@ class BillSchedule
 
     #[ORM\ManyToOne(targetEntity: Organization::class, cascade: [], inversedBy: 'billSchedules')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
-    protected App\Entity\Organization\Organization $organization;
+    protected Organization $organization;
 
     #[ORM\OneToMany(mappedBy: 'billSchedule', targetEntity: BillScheduleDate::class, cascade: ['persist'], orphanRemoval: true)]
     protected Collection $scheduleDates;
@@ -34,34 +32,36 @@ class BillSchedule
     #[ORM\OneToMany(mappedBy: 'billSchedule', targetEntity: AccessWish::class, cascade: [], orphanRemoval: false)] // TODO: à revoir
     protected Collection $accessWishes;
 
-    function getId(): int
+    public function getId(): int
     {
         return $this->id;
     }
 
-    function setId(int $id): self
+    public function setId(int $id): self
     {
         $this->id = $id;
+
         return $this;
     }
 
-    function getOrganization(): App\Entity\Organization\Organization
+    public function getOrganization(): Organization
     {
         return $this->organization;
     }
 
-    function setOrganization(App\Entity\Organization\Organization $organization): self
+    public function setOrganization(Organization $organization): self
     {
         $this->organization = $organization;
+
         return $this;
     }
 
-    function getScheduleDates(): Collection
+    public function getScheduleDates(): Collection
     {
         return $this->scheduleDates;
     }
 
-    function addScheduleDate(BillScheduleDate $scheduleDate): self
+    public function addScheduleDate(BillScheduleDate $scheduleDate): self
     {
         if (!$this->scheduleDates->contains($scheduleDate)) {
             $this->scheduleDates[] = $scheduleDate;
@@ -71,7 +71,7 @@ class BillSchedule
         return $this;
     }
 
-    function removeScheduleDate(BillScheduleDate $scheduleDate): self
+    public function removeScheduleDate(BillScheduleDate $scheduleDate): self
     {
         if ($this->scheduleDates->removeElement($scheduleDate)) {
             $scheduleDate->setBillSchedule(null);
@@ -80,12 +80,12 @@ class BillSchedule
         return $this;
     }
 
-    function getAccessBilling(): Collection
+    public function getAccessBilling(): Collection
     {
         return $this->accessBilling;
     }
 
-    function addAccessBilling(AccessBilling $accessBilling): self
+    public function addAccessBilling(AccessBilling $accessBilling): self
     {
         if (!$this->accessBilling->contains($accessBilling)) {
             $this->accessBilling[] = $accessBilling;
@@ -95,21 +95,21 @@ class BillSchedule
         return $this;
     }
 
-    function removeAccessBilling(AccessBilling $accessBilling): self
+    public function removeAccessBilling(AccessBilling $accessBilling): self
     {
         if ($this->accessBilling->removeElement($accessBilling)) {
-//            $accessBilling->setBillSchedule(null);  // TODO: actuellement, pas nullable: conserver?
+            //            $accessBilling->setBillSchedule(null);  // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;
     }
 
-    function getAccessWishes(): Collection
+    public function getAccessWishes(): Collection
     {
         return $this->accessWishes;
     }
 
-    function addAccessWish(AccessWish $accessWish): self
+    public function addAccessWish(AccessWish $accessWish): self
     {
         if (!$this->accessWishes->contains($accessWish)) {
             $this->accessWishes[] = $accessWish;
@@ -119,10 +119,10 @@ class BillSchedule
         return $this;
     }
 
-    function removeAccessWish(AccessWish $accessWish): self
+    public function removeAccessWish(AccessWish $accessWish): self
     {
         if ($this->accessWishes->removeElement($accessWish)) {
-//            $accessWish->setBillSchedule(null);  // TODO: actuellement, pas nullable: conserver?
+            //            $accessWish->setBillSchedule(null);  // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;

+ 1 - 0
src/Entity/Billing/BillingExportSetting.php

@@ -85,6 +85,7 @@ class BillingExportSetting
     public function removeStageManager(Access $stageManager): self
     {
         $this->stageManagers->removeElement($stageManager);
+
         // TODO: compléter (je n'ai pas le mappedBy)
         return $this;
     }

+ 10 - 10
src/Entity/Billing/CirilCivil.php

@@ -5,9 +5,7 @@ declare(strict_types=1);
 namespace App\Entity\Billing;
 
 use ApiPlatform\Metadata\ApiResource;
-use App;
 use App\Entity\Core\File;
-use DateTimeInterface;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
@@ -24,25 +22,26 @@ class CirilCivil
     protected Collection $bills;
 
     #[ORM\OneToOne(targetEntity: File::class, cascade: ['persist'])]
-    protected App\Entity\Core\File $file;
+    protected File $file;
 
-    function getId(): int
+    public function getId(): int
     {
         return $this->id;
     }
 
-    function setId(int $id): self
+    public function setId(int $id): self
     {
         $this->id = $id;
+
         return $this;
     }
 
-    function getBills(): Collection
+    public function getBills(): Collection
     {
         return $this->bills;
     }
 
-    function addBill(Bill $bill): self
+    public function addBill(Bill $bill): self
     {
         if (!$this->bills->contains($bill)) {
             $this->bills[] = $bill;
@@ -52,21 +51,22 @@ class CirilCivil
         return $this;
     }
 
-    function removeBill(Bill $bill): self
+    public function removeBill(Bill $bill): self
     {
         $this->bills->removeElement($bill);
 
         return $this;
     }
 
-    function getFile(): App\Entity\Core\File
+    public function getFile(): File
     {
         return $this->file;
     }
 
-    function setFile(App\Entity\Core\File $file): self
+    public function setFile(File $file): self
     {
         $this->file = $file;
+
         return $this;
     }
 }

+ 13 - 12
src/Entity/Billing/FamilyQuotientBand.php

@@ -6,7 +6,6 @@ namespace App\Entity\Billing;
 
 use ApiPlatform\Metadata\ApiResource;
 use App\Entity\Product\IntangibleDiscountDetail;
-use DateTimeInterface;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
@@ -34,34 +33,36 @@ class FamilyQuotientBand
     #[ORM\OneToMany(mappedBy: 'familyQuotientBand', targetEntity: IntangibleDiscountDetail::class, cascade: [], orphanRemoval: true)]
     protected Collection $intangibleDiscountDetails;
 
-    function getId(): int
+    public function getId(): int
     {
         return $this->id;
     }
 
-    function setId(int $id): self
+    public function setId(int $id): self
     {
         $this->id = $id;
+
         return $this;
     }
 
-    function getFamilyQuotientModel(): mixed
+    public function getFamilyQuotientModel(): mixed
     {
         return $this->familyQuotientModel;
     }
 
-    function setFamilyQuotientModel(mixed $familyQuotientModel): self
+    public function setFamilyQuotientModel(mixed $familyQuotientModel): self
     {
         $this->familyQuotientModel = $familyQuotientModel;
+
         return $this;
     }
 
-    function getFamilyQuotientBandDetails(): Collection
+    public function getFamilyQuotientBandDetails(): Collection
     {
         return $this->familyQuotientBandDetails;
     }
 
-    function addFamilyQuotientBandDetail(FamilyQuotientBandDetail $familyQuotientBandDetail): self
+    public function addFamilyQuotientBandDetail(FamilyQuotientBandDetail $familyQuotientBandDetail): self
     {
         if (!$this->familyQuotientBandDetails->contains($familyQuotientBandDetail)) {
             $this->familyQuotientBandDetails[] = $familyQuotientBandDetail;
@@ -71,7 +72,7 @@ class FamilyQuotientBand
         return $this;
     }
 
-    function removeFamilyQuotientBandDetail(FamilyQuotientBandDetail $familyQuotientBandDetail): self
+    public function removeFamilyQuotientBandDetail(FamilyQuotientBandDetail $familyQuotientBandDetail): self
     {
         if ($this->familyQuotientBandDetails->removeElement($familyQuotientBandDetail)) {
             $familyQuotientBandDetail->setFamilyQuotientBand(null);
@@ -80,12 +81,12 @@ class FamilyQuotientBand
         return $this;
     }
 
-    function getIntangibleDiscountDetails(): Collection
+    public function getIntangibleDiscountDetails(): Collection
     {
         return $this->intangibleDiscountDetails;
     }
 
-    function addIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
+    public function addIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
     {
         if (!$this->intangibleDiscountDetails->contains($intangibleDiscountDetail)) {
             $this->intangibleDiscountDetails[] = $intangibleDiscountDetail;
@@ -95,10 +96,10 @@ class FamilyQuotientBand
         return $this;
     }
 
-    function removeIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
+    public function removeIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
     {
         $this->intangibleDiscountDetails->removeElement($intangibleDiscountDetail);
-        
+
         return $this;
     }
 }

+ 13 - 12
src/Entity/Billing/FamilyQuotientBandDetail.php

@@ -5,9 +5,7 @@ declare(strict_types=1);
 namespace App\Entity\Billing;
 
 use ApiPlatform\Metadata\ApiResource;
-use App;
 use App\Entity\Product\IntangibleDiscountDetail;
-use DateTimeInterface;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
@@ -26,50 +24,53 @@ class FamilyQuotientBandDetail
 
     #[ORM\ManyToOne(targetEntity: ResidenceArea::class, cascade: [], inversedBy: 'intangibleDiscountDetails')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
-    protected App\Entity\Billing\ResidenceArea $residenceArea;
+    protected ResidenceArea $residenceArea;
 
     #[ORM\OneToMany(mappedBy: 'familyQuotientBandDetail', targetEntity: IntangibleDiscountDetail::class, cascade: [], orphanRemoval: true)]
     protected Collection $intangibleDiscountDetails;
 
-    function getId(): int
+    public function getId(): int
     {
         return $this->id;
     }
 
-    function setId(int $id): self
+    public function setId(int $id): self
     {
         $this->id = $id;
+
         return $this;
     }
 
-    function getFamilyQuotientBand(): mixed
+    public function getFamilyQuotientBand(): mixed
     {
         return $this->familyQuotientBand;
     }
 
-    function setFamilyQuotientBand(mixed $familyQuotientBand): self
+    public function setFamilyQuotientBand(mixed $familyQuotientBand): self
     {
         $this->familyQuotientBand = $familyQuotientBand;
+
         return $this;
     }
 
-    function getResidenceArea(): App\Entity\Billing\ResidenceArea
+    public function getResidenceArea(): ResidenceArea
     {
         return $this->residenceArea;
     }
 
-    function setResidenceArea(App\Entity\Billing\ResidenceArea $residenceArea): self
+    public function setResidenceArea(ResidenceArea $residenceArea): self
     {
         $this->residenceArea = $residenceArea;
+
         return $this;
     }
 
-    function getIntangibleDiscountDetails(): Collection
+    public function getIntangibleDiscountDetails(): Collection
     {
         return $this->intangibleDiscountDetails;
     }
 
-    function addIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
+    public function addIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
     {
         if (!$this->intangibleDiscountDetails->contains($intangibleDiscountDetail)) {
             $this->intangibleDiscountDetails[] = $intangibleDiscountDetail;
@@ -79,7 +80,7 @@ class FamilyQuotientBandDetail
         return $this;
     }
 
-    function removeIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
+    public function removeIntangibleDiscountDetail(IntangibleDiscountDetail $intangibleDiscountDetail): self
     {
         $this->intangibleDiscountDetails->removeElement($intangibleDiscountDetail);
 

+ 13 - 13
src/Entity/Billing/FamilyQuotientModel.php

@@ -5,10 +5,8 @@ declare(strict_types=1);
 namespace App\Entity\Billing;
 
 use ApiPlatform\Metadata\ApiResource;
-use App;
 use App\Entity\Organization\Organization;
 use App\Entity\Product\IntangiblePriceAndDiscount;
-use DateTimeInterface;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
@@ -23,7 +21,7 @@ class FamilyQuotientModel
 
     #[ORM\ManyToOne(targetEntity: Organization::class, cascade: [], inversedBy: 'familyQuotientModels')]
     #[ORM\JoinColumn(nullable: false)]
-    protected App\Entity\Organization\Organization $organization;
+    protected Organization $organization;
 
     #[ORM\OneToMany(mappedBy: 'familyQuotientModel', targetEntity: FamilyQuotientBand::class, cascade: ['persist'], orphanRemoval: true)]
     protected Collection $familyQuotientBands;
@@ -31,34 +29,36 @@ class FamilyQuotientModel
     #[ORM\OneToMany(mappedBy: 'familyQuotientModel', targetEntity: IntangiblePriceAndDiscount::class, cascade: [], orphanRemoval: false)]
     protected Collection $intangiblePriceAndDiscounts;
 
-    function getId(): int
+    public function getId(): int
     {
         return $this->id;
     }
 
-    function setId(int $id): self
+    public function setId(int $id): self
     {
         $this->id = $id;
+
         return $this;
     }
 
-    function getOrganization(): App\Entity\Organization\Organization
+    public function getOrganization(): Organization
     {
         return $this->organization;
     }
 
-    function setOrganization(App\Entity\Organization\Organization $organization): self
+    public function setOrganization(Organization $organization): self
     {
         $this->organization = $organization;
+
         return $this;
     }
 
-    function getFamilyQuotientBands(): Collection
+    public function getFamilyQuotientBands(): Collection
     {
         return $this->familyQuotientBands;
     }
 
-    function addFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
+    public function addFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
     {
         if (!$this->familyQuotientBands->contains($familyQuotientBand)) {
             $this->familyQuotientBands[] = $familyQuotientBand;
@@ -68,7 +68,7 @@ class FamilyQuotientModel
         return $this;
     }
 
-    function removeFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
+    public function removeFamilyQuotientBand(FamilyQuotientBand $familyQuotientBand): self
     {
         if ($this->familyQuotientBands->removeElement($familyQuotientBand)) {
             $familyQuotientBand->setFamilyQuotientModel(null);
@@ -77,12 +77,12 @@ class FamilyQuotientModel
         return $this;
     }
 
-    function getIntangiblePriceAndDiscounts(): Collection
+    public function getIntangiblePriceAndDiscounts(): Collection
     {
         return $this->intangiblePriceAndDiscounts;
     }
 
-    function addIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
+    public function addIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
     {
         if (!$this->intangiblePriceAndDiscounts->contains($intangiblePriceAndDiscount)) {
             $this->intangiblePriceAndDiscounts[] = $intangiblePriceAndDiscount;
@@ -92,7 +92,7 @@ class FamilyQuotientModel
         return $this;
     }
 
-    function removeIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
+    public function removeIntangiblePriceAndDiscount(IntangiblePriceAndDiscount $intangiblePriceAndDiscount): self
     {
         if ($this->intangiblePriceAndDiscounts->removeElement($intangiblePriceAndDiscount)) {
             $intangiblePriceAndDiscount->setFamilyQuotientModel(null);

+ 11 - 11
src/Entity/Billing/Odyssee.php

@@ -5,9 +5,7 @@ declare(strict_types=1);
 namespace App\Entity\Billing;
 
 use ApiPlatform\Metadata\ApiResource;
-use App;
 use App\Entity\Core\File;
-use DateTimeInterface;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
@@ -24,25 +22,26 @@ class Odyssee
     protected Collection $bills;
 
     #[ORM\OneToOne(targetEntity: File::class, cascade: ['persist'])]
-    protected App\Entity\Core\File $file;
+    protected File $file;
 
-    function getId(): int
+    public function getId(): int
     {
         return $this->id;
     }
 
-    function setId(int $id): self
+    public function setId(int $id): self
     {
         $this->id = $id;
+
         return $this;
     }
 
-    function getBills(): Collection
+    public function getBills(): Collection
     {
         return $this->bills;
     }
 
-    function addBill(Bill $bill): self
+    public function addBill(Bill $bill): self
     {
         if (!$this->bills->contains($bill)) {
             $this->bills[] = $bill;
@@ -52,23 +51,24 @@ class Odyssee
         return $this;
     }
 
-    function removeBill(Bill $bill): self
+    public function removeBill(Bill $bill): self
     {
         if ($this->bills->removeElement($bill)) {
-//            $bill->setOdyssee(null); // TODO: actuellement, pas nullable: conserver?
+            //            $bill->setOdyssee(null); // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;
     }
 
-    function getFile(): App\Entity\Core\File
+    public function getFile(): File
     {
         return $this->file;
     }
 
-    function setFile(App\Entity\Core\File $file): self
+    public function setFile(File $file): self
     {
         $this->file = $file;
+
         return $this;
     }
 }

+ 1 - 1
src/Entity/Billing/SddBank.php

@@ -56,7 +56,7 @@ class SddBank
     public function removeBillPayment(BillPayment $billPayment): self
     {
         if ($this->billPayments->removeElement($billPayment)) {
-//            $billPayment->setSddBank(null); // TODO: actuellement, pas nullable: conserver?
+            //            $billPayment->setSddBank(null); // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;

+ 1 - 1
src/Entity/Billing/SddRegie.php

@@ -60,7 +60,7 @@ class SddRegie
     public function removeBillPayment(BillPayment $billPayment): self
     {
         if ($this->billPayments->removeElement($billPayment)) {
-//            $billPayment->setSddBank(null); // TODO: actuellement, pas nullable: conserver?
+            //            $billPayment->setSddBank(null); // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;

+ 0 - 2
src/Entity/Booking/Examen.php

@@ -5,7 +5,6 @@ declare(strict_types=1);
 namespace App\Entity\Booking;
 
 use ApiPlatform\Metadata\ApiResource;
-use App\Entity\Access\Access;
 use App\Entity\Core\Tagg;
 use App\Entity\Education\Education;
 use App\Entity\Education\EducationCurriculum;
@@ -14,7 +13,6 @@ use App\Entity\Organization\Organization;
 use App\Entity\Place\AbstractPlace;
 use App\Entity\Place\Room;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
-use App\Entity\Product\Equipment;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;

+ 0 - 3
src/Entity/Booking/OrganizationHoliday.php

@@ -5,11 +5,8 @@ declare(strict_types=1);
 namespace App\Entity\Booking;
 
 use ApiPlatform\Metadata\ApiResource;
-use App\Entity\Access\Access;
-use App\Entity\Core\Tagg;
 use App\Entity\Organization\Organization;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
-use App\Entity\Product\Equipment;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;

+ 0 - 2
src/Entity/Booking/PersonHoliday.php

@@ -7,9 +7,7 @@ namespace App\Entity\Booking;
 use ApiPlatform\Metadata\ApiResource;
 use App\Entity\Access\Access;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
-use App\Entity\Core\Tagg;
 use App\Entity\Organization\Organization;
-use App\Entity\Product\Equipment;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;

+ 2 - 2
src/Entity/Core/AbstractRepair.php

@@ -34,7 +34,7 @@ abstract class AbstractRepair
         return $this->tags;
     }
 
-    function addTag(Tagg $tag): self
+    public function addTag(Tagg $tag): self
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
@@ -44,7 +44,7 @@ abstract class AbstractRepair
         return $this;
     }
 
-    function removeTag(Tagg $tag): self
+    public function removeTag(Tagg $tag): self
     {
         if ($this->tags->removeElement($tag)) {
             $tag->removeRepair($this);

+ 1 - 1
src/Entity/Core/AddressPostal.php

@@ -272,7 +272,7 @@ class AddressPostal
     public function removeOrganizationAddressPostal(OrganizationAddressPostal $organizationAddressPostal): self
     {
         if ($this->organizationAddressPostals->removeElement($organizationAddressPostal)) {
-//            $organizationAddressPostal->setAddressPostal(null); // TODO: actuellement, pas nullable: conserver?
+            //            $organizationAddressPostal->setAddressPostal(null); // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;

+ 3 - 3
src/Entity/Core/File.php

@@ -753,7 +753,7 @@ class File
         return $this->networks;
     }
 
-    function addNetwork(Network $network): self
+    public function addNetwork(Network $network): self
     {
         if (!$this->networks->contains($network)) {
             $this->networks[] = $network;
@@ -763,10 +763,10 @@ class File
         return $this;
     }
 
-    function removeNetwork(Network $network): self
+    public function removeNetwork(Network $network): self
     {
         if ($this->networks->removeElement($network)) {
-//            $network->setImage(null);  // TODO: actuellement, pas nullable: conserver?
+            //            $network->setImage(null);  // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;

+ 3 - 3
src/Entity/Education/EducationCurriculum.php

@@ -286,12 +286,12 @@ class EducationCurriculum
         return $this;
     }
 
-    function getRequiredEducationCurriculumPacks(): Collection
+    public function getRequiredEducationCurriculumPacks(): Collection
     {
         return $this->requiredEducationCurriculumPacks;
     }
 
-    function addRequiredEducationCurriculumPack(EducationCurriculumPack $requiredEducationCurriculumPack): self
+    public function addRequiredEducationCurriculumPack(EducationCurriculumPack $requiredEducationCurriculumPack): self
     {
         if (!$this->requiredEducationCurriculumPacks->contains($requiredEducationCurriculumPack)) {
             $this->requiredEducationCurriculumPacks[] = $requiredEducationCurriculumPack;
@@ -301,7 +301,7 @@ class EducationCurriculum
         return $this;
     }
 
-    function removeRequiredEducationCurriculumPack(EducationCurriculumPack $requiredEducationCurriculumPack): self
+    public function removeRequiredEducationCurriculumPack(EducationCurriculumPack $requiredEducationCurriculumPack): self
     {
         if ($this->requiredEducationCurriculumPacks->removeElement($requiredEducationCurriculumPack)) {
             $requiredEducationCurriculumPack->removeRequiredEducationCurriculum($this);

+ 22 - 23
src/Entity/Education/EducationCurriculumPack.php

@@ -5,12 +5,9 @@ declare(strict_types=1);
 namespace App\Entity\Education;
 
 use ApiPlatform\Metadata\ApiResource;
-use App;
 use App\Entity\Core\Tagg;
 use App\Entity\Organization\Organization;
 use App\Entity\Product\Intangible;
-use DateTimeInterface;
-use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
@@ -25,7 +22,7 @@ class EducationCurriculumPack
 
     #[ORM\ManyToOne(targetEntity: Organization::class, cascade: [], inversedBy: 'educationCurriculumPacks')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
-    public App\Entity\Organization\Organization $organization;
+    public Organization $organization;
 
     #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'educationCurriculumPacks', cascade: ['persist'], orphanRemoval: false)]
     public Collection $tags;
@@ -57,34 +54,36 @@ class EducationCurriculumPack
     #[ORM\ManyToMany(targetEntity: Intangible::class, mappedBy: 'educationCurriculumPacks', cascade: [], orphanRemoval: false)]
     public Collection $intangibles;
 
-    function getId(): int
+    public function getId(): int
     {
         return $this->id;
     }
 
-    function setId(int $id): self
+    public function setId(int $id): self
     {
         $this->id = $id;
+
         return $this;
     }
 
-    function getOrganization(): App\Entity\Organization\Organization
+    public function getOrganization(): Organization
     {
         return $this->organization;
     }
 
-    function setOrganization(App\Entity\Organization\Organization $organization): self
+    public function setOrganization(Organization $organization): self
     {
         $this->organization = $organization;
+
         return $this;
     }
 
-    function getTags(): Collection
+    public function getTags(): Collection
     {
         return $this->tags;
     }
 
-    function addTag(Tagg $tag): self
+    public function addTag(Tagg $tag): self
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
@@ -94,7 +93,7 @@ class EducationCurriculumPack
         return $this;
     }
 
-    function removeTag(Tagg $tag): self
+    public function removeTag(Tagg $tag): self
     {
         if ($this->tags->removeElement($tag)) {
             $tag->removeEducationCurriculumPack($this);
@@ -103,12 +102,12 @@ class EducationCurriculumPack
         return $this;
     }
 
-    function getRequiredEducationCurriculums(): Collection
+    public function getRequiredEducationCurriculums(): Collection
     {
         return $this->requiredEducationCurriculums;
     }
 
-    function addRequiredEducationCurriculum(EducationCurriculum $requiredEducationCurriculum): self
+    public function addRequiredEducationCurriculum(EducationCurriculum $requiredEducationCurriculum): self
     {
         if (!$this->requiredEducationCurriculums->contains($requiredEducationCurriculum)) {
             $this->requiredEducationCurriculums[] = $requiredEducationCurriculum;
@@ -118,7 +117,7 @@ class EducationCurriculumPack
         return $this;
     }
 
-    function removeRequiredEducationCurriculum(EducationCurriculum $requiredEducationCurriculum): self
+    public function removeRequiredEducationCurriculum(EducationCurriculum $requiredEducationCurriculum): self
     {
         if ($this->requiredEducationCurriculums->removeElement($requiredEducationCurriculum)) {
             $requiredEducationCurriculum->removeRequiredEducationCurriculumPack($this);
@@ -127,12 +126,12 @@ class EducationCurriculumPack
         return $this;
     }
 
-    function getRequiredChoicesEducationCurriculums(): Collection
+    public function getRequiredChoicesEducationCurriculums(): Collection
     {
         return $this->requiredChoicesEducationCurriculums;
     }
 
-    function addRequiredChoicesEducationCurriculum(EducationCurriculum $requiredChoicesEducationCurriculum): self
+    public function addRequiredChoicesEducationCurriculum(EducationCurriculum $requiredChoicesEducationCurriculum): self
     {
         if (!$this->requiredChoicesEducationCurriculums->contains($requiredChoicesEducationCurriculum)) {
             $this->requiredChoicesEducationCurriculums[] = $requiredChoicesEducationCurriculum;
@@ -142,7 +141,7 @@ class EducationCurriculumPack
         return $this;
     }
 
-    function removeRequiredChoicesEducationCurriculum(EducationCurriculum $requiredChoicesEducationCurriculum): self
+    public function removeRequiredChoicesEducationCurriculum(EducationCurriculum $requiredChoicesEducationCurriculum): self
     {
         if ($this->requiredChoicesEducationCurriculums->removeElement($requiredChoicesEducationCurriculum)) {
             $requiredChoicesEducationCurriculum->removeRequiredChoicesEducationCurriculumPack($this);
@@ -151,12 +150,12 @@ class EducationCurriculumPack
         return $this;
     }
 
-    function getOptionnalEducationCurriculums(): Collection
+    public function getOptionnalEducationCurriculums(): Collection
     {
         return $this->optionnalEducationCurriculums;
     }
 
-    function addOptionnalEducationCurriculum(EducationCurriculum $optionnalEducationCurriculum): self
+    public function addOptionnalEducationCurriculum(EducationCurriculum $optionnalEducationCurriculum): self
     {
         if (!$this->optionnalEducationCurriculums->contains($optionnalEducationCurriculum)) {
             $this->optionnalEducationCurriculums[] = $optionnalEducationCurriculum;
@@ -166,7 +165,7 @@ class EducationCurriculumPack
         return $this;
     }
 
-    function removeOptionnalEducationCurriculum(EducationCurriculum $optionnalEducationCurriculum): self
+    public function removeOptionnalEducationCurriculum(EducationCurriculum $optionnalEducationCurriculum): self
     {
         if ($this->optionnalEducationCurriculums->removeElement($optionnalEducationCurriculum)) {
             $optionnalEducationCurriculum->removeOptionnalEducationCurriculumPack($this);
@@ -175,12 +174,12 @@ class EducationCurriculumPack
         return $this;
     }
 
-    function getIntangibles(): Collection
+    public function getIntangibles(): Collection
     {
         return $this->intangibles;
     }
 
-    function addIntangible(Intangible $intangible): self
+    public function addIntangible(Intangible $intangible): self
     {
         if (!$this->intangibles->contains($intangible)) {
             $this->intangibles[] = $intangible;
@@ -190,7 +189,7 @@ class EducationCurriculumPack
         return $this;
     }
 
-    function removeIntangible(Intangible $intangible): self
+    public function removeIntangible(Intangible $intangible): self
     {
         if ($this->intangibles->removeElement($intangible)) {
             $intangible->removeEducationCurriculumPack($this);

+ 4 - 4
src/Entity/Message/AbstractMessage.php

@@ -148,20 +148,20 @@ abstract class AbstractMessage
         return $this->files;
     }
 
-    function addFile(File $file): self
+    public function addFile(File $file): self
     {
         if (!$this->files->contains($file)) {
             $this->files[] = $file;
-//            $file->addXXXX($this);  // TODO: quel méthode?
+            //            $file->addXXXX($this);  // TODO: quel méthode?
         }
 
         return $this;
     }
 
-    function removeFile(File $file): self
+    public function removeFile(File $file): self
     {
         if ($this->files->removeElement($file)) {
-//            $file->removeXXX($this);  // TODO: quel méthode?
+            //            $file->removeXXX($this);  // TODO: quel méthode?
         }
 
         return $this;

+ 14 - 12
src/Entity/Message/ReportMessage.php

@@ -5,10 +5,8 @@ declare(strict_types=1);
 namespace App\Entity\Message;
 
 use ApiPlatform\Metadata\ApiResource;
-use App;
 use App\Entity\Access\Access;
 use App\Entity\Organization\Organization;
-use DateTimeInterface;
 use Doctrine\ORM\Mapping as ORM;
 
 #[ApiResource(operations: [])]
@@ -25,53 +23,57 @@ class ReportMessage
 
     #[ORM\ManyToOne(targetEntity: Access::class, cascade: [])]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
-    public App\Entity\Access\Access $access;
+    public Access $access;
 
     #[ORM\ManyToOne(targetEntity: Organization::class, cascade: [])]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
-    public App\Entity\Organization\Organization $organization;
+    public Organization $organization;
 
-    function getId(): int
+    public function getId(): int
     {
         return $this->id;
     }
 
-    function setId(int $id): self
+    public function setId(int $id): self
     {
         $this->id = $id;
+
         return $this;
     }
 
-    function getMessage(): mixed
+    public function getMessage(): mixed
     {
         return $this->message;
     }
 
-    function setMessage(mixed $message): self
+    public function setMessage(mixed $message): self
     {
         $this->message = $message;
+
         return $this;
     }
 
-    function getAccess(): App\Entity\Access\Access
+    public function getAccess(): Access
     {
         return $this->access;
     }
 
-    function setAccess(App\Entity\Access\Access $access): self
+    public function setAccess(Access $access): self
     {
         $this->access = $access;
+
         return $this;
     }
 
-    function getOrganization(): App\Entity\Organization\Organization
+    public function getOrganization(): Organization
     {
         return $this->organization;
     }
 
-    function setOrganization(App\Entity\Organization\Organization $organization): self
+    public function setOrganization(Organization $organization): self
     {
         $this->organization = $organization;
+
         return $this;
     }
 }

+ 2 - 2
src/Entity/Organization/Organization.php

@@ -2086,7 +2086,7 @@ class Organization
     public function removeFamilyQuotientModel(FamilyQuotientModel $familyQuotientModel): self
     {
         if ($this->familyQuotientModels->removeElement($familyQuotientModel)) {
-//            $familyQuotientModel->setOrganization(null); // TODO: actuellement, pas nullable: conserver?
+            //            $familyQuotientModel->setOrganization(null); // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;
@@ -2110,7 +2110,7 @@ class Organization
     public function removeBillSchedule(BillSchedule $billSchedule): self
     {
         if ($this->billSchedules->removeElement($billSchedule)) {
-//            $billSchedule->setOrganization(null);  // TODO: actuellement, pas nullable: conserver?
+            //            $billSchedule->setOrganization(null);  // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;

+ 3 - 3
src/Entity/Person/Person.php

@@ -612,7 +612,7 @@ class Person implements UserInterface, PasswordAuthenticatedUserInterface
         return $this->allowedIps;
     }
 
-    function addAllowedIp(AllowedIp $allowedIp): self
+    public function addAllowedIp(AllowedIp $allowedIp): self
     {
         if (!$this->allowedIps->contains($allowedIp)) {
             $this->allowedIps[] = $allowedIp;
@@ -622,10 +622,10 @@ class Person implements UserInterface, PasswordAuthenticatedUserInterface
         return $this;
     }
 
-    function removeAllowedIp(AllowedIp $allowedIp): self
+    public function removeAllowedIp(AllowedIp $allowedIp): self
     {
         if ($this->allowedIps->removeElement($allowedIp)) {
-//            $allowedIp->setPerson(null);  // TODO: actuellement, pas nullable: conserver?
+            //            $allowedIp->setPerson(null);  // TODO: actuellement, pas nullable: conserver?
         }
 
         return $this;

+ 3 - 3
src/Entity/Place/RoomControl.php

@@ -56,12 +56,12 @@ class RoomControl extends AbstractControl
         return $this;
     }
 
-    function getTags(): Collection
+    public function getTags(): Collection
     {
         return $this->tags;
     }
 
-    function addTag(Tagg $tag): self
+    public function addTag(Tagg $tag): self
     {
         if (!$this->tags->contains($tag)) {
             $this->tags[] = $tag;
@@ -71,7 +71,7 @@ class RoomControl extends AbstractControl
         return $this;
     }
 
-    function removeTag(Tagg $tag): self
+    public function removeTag(Tagg $tag): self
     {
         if ($this->tags->removeElement($tag)) {
             $tag->removeControl($this);

+ 7 - 7
src/Entity/Token/Token.php

@@ -5,9 +5,7 @@ declare(strict_types=1);
 namespace App\Entity\Token;
 
 use ApiPlatform\Metadata\ApiResource;
-use App;
 use App\Entity\Access\Access;
-use DateTimeInterface;
 use Doctrine\ORM\Mapping as ORM;
 
 #[ApiResource(operations: [])]
@@ -21,27 +19,29 @@ class Token
 
     #[ORM\ManyToOne(targetEntity: Access::class, cascade: [], inversedBy: 'tokens')]
     #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
-    private App\Entity\Access\Access $access;
+    private Access $access;
 
-    function getId(): int
+    public function getId(): int
     {
         return $this->id;
     }
 
-    function setId(int $id): self
+    public function setId(int $id): self
     {
         $this->id = $id;
+
         return $this;
     }
 
-    function getAccess(): App\Entity\Access\Access
+    public function getAccess(): Access
     {
         return $this->access;
     }
 
-    function setAccess(App\Entity\Access\Access $access): self
+    public function setAccess(Access $access): self
     {
         $this->access = $access;
+
         return $this;
     }
 }

+ 6 - 7
src/Service/Cron/Job/SchemaValidation.php

@@ -15,7 +15,7 @@ use JetBrains\PhpStorm\Pure;
  */
 class SchemaValidation extends BaseCronJob
 {
-    const VALIDATION_FILTER = DiffTypeEnum::MISSING_RELATION;
+    public const VALIDATION_FILTER = DiffTypeEnum::MISSING_RELATION;
 
     #[Pure]
     public function __construct(
@@ -34,9 +34,8 @@ class SchemaValidation extends BaseCronJob
         return $this->schemaValidationService->formatToCsv($diff);
     }
 
-
     /**
-     * Validate the doctrine schema (without reporting)
+     * Validate the doctrine schema (without reporting).
      */
     public function preview(): void
     {
@@ -48,13 +47,13 @@ class SchemaValidation extends BaseCronJob
             foreach ($csv as $line) {
                 $this->ui->print($line);
             }
-            $this->ui->print("");
-            $this->ui->print("> " . count($csv) . " differences found");
+            $this->ui->print('');
+            $this->ui->print('> '.count($csv).' differences found');
         }
     }
 
     /**
-     * Validate the doctrine schema and report
+     * Validate the doctrine schema and report.
      */
     public function execute(): void
     {
@@ -66,7 +65,7 @@ class SchemaValidation extends BaseCronJob
             foreach ($csv as $line) {
                 $this->logger->warning($line);
             }
-            $this->logger->warning(count($csv) . " differences found");
+            $this->logger->warning(count($csv).' differences found');
         }
     }
 }

+ 10 - 6
src/Service/Doctrine/SchemaValidation/Difference.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace App\Service\Doctrine\SchemaValidation;
@@ -13,14 +14,13 @@ class Difference
     /**
      * @var string|array<string, string|array<string>>
      */
-    protected string | array $expectedType;
+    protected string|array $expectedType;
 
     /**
-     * @param DiffTypeEnum $type
-     * @param string|null $message
      * @param string|array<string, string|array<string>> $expectedType
      */
-    public function __construct(DiffTypeEnum $type, ?string $message, string | array $expectedType = []) {
+    public function __construct(DiffTypeEnum $type, ?string $message, string|array $expectedType = [])
+    {
         $this->type = $type;
         $this->message = $message;
         $this->expectedType = $expectedType;
@@ -34,6 +34,7 @@ class Difference
     public function setType(DiffTypeEnum $type): self
     {
         $this->type = $type;
+
         return $this;
     }
 
@@ -45,24 +46,27 @@ class Difference
     public function setMessage(?string $message): self
     {
         $this->message = $message;
+
         return $this;
     }
 
     /**
      * @return string|array<string, string|array<string>>
      */
-    public function getExpectedType(): string | array
+    public function getExpectedType(): string|array
     {
         return $this->expectedType;
     }
 
     /**
      * @param string|array<string, string|array<string>> $expectedType
+     *
      * @return $this
      */
-    public function setExpectedType(string | array $expectedType): self
+    public function setExpectedType(string|array $expectedType): self
     {
         $this->expectedType = $expectedType;
+
         return $this;
     }
 }

+ 96 - 124
src/Service/Doctrine/SchemaValidation/SchemaSnippetsMaker.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace App\Service\Doctrine\SchemaValidation;
@@ -39,16 +40,15 @@ use Nette\PhpGenerator\PsrPrinter;
 class SchemaSnippetsMaker
 {
     public function __construct(
-        private readonly EntityUtils $entityUtils
-    )
-    {}
+        private readonly EntityUtils $entityUtils,
+    ) {
+    }
 
     /**
      * Make entities snippets from a 'diff' array,
-     * as generated by SchemaValidationService::validateSchema()
+     * as generated by SchemaValidationService::validateSchema().
      *
      * @param array<string, Difference | array<Difference>> $diff
-     * @return void
      */
     public function makeSnippets(array $diff): void
     {
@@ -128,12 +128,12 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Make the getters / setters for the given property
+     * Make the getters / setters for the given property.
      *
-     * @param Property $prop
      * @return array<Method>
      */
-    protected function makeMethodsSnippetForProp(Property $prop): array {
+    protected function makeMethodsSnippetForProp(Property $prop): array
+    {
         $methods = [];
 
         if ($prop->getType() !== Collection::class) {
@@ -149,11 +149,9 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Génère un objet ClassType
-     * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/ClassType.html
+     * Génère un objet ClassType.
      *
-     * @param string $entity
-     * @return ClassType
+     * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/ClassType.html
      */
     protected function makeSnippetEntityClass(string $entity): ClassType
     {
@@ -161,15 +159,14 @@ class SchemaSnippetsMaker
 
         $class->setAttributes([
             new Attribute(ApiResource::class, ['operations' => []]),
-            new Attribute(Entity::class, [])
+            new Attribute(Entity::class, []),
         ]);
 
         return $class;
     }
 
     /**
-     * Retourne le chemin absolu vers le répertoire dans lesquels sont créés les snippets
-     * @return string
+     * Retourne le chemin absolu vers le répertoire dans lesquels sont créés les snippets.
      */
     protected function getSnippetsDir(): string
     {
@@ -177,12 +174,10 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Vide et ajuste les droits du répertoire des snippets
-     *
-     * @param string $snippetsDir
-     * @return void
+     * Vide et ajuste les droits du répertoire des snippets.
      */
-    protected function prepareSnippetsDir(string $snippetsDir): void {
+    protected function prepareSnippetsDir(string $snippetsDir): void
+    {
         if (is_dir($snippetsDir)) {
             FileUtils::rrmDir($snippetsDir);
         }
@@ -190,38 +185,31 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Retourne le chemin absolu du snippet donné
-     *
-     * @param string $snippetsDir
-     * @param string $entity
-     * @return string
+     * Retourne le chemin absolu du snippet donné.
      */
     protected function getSnippetPath(string $snippetsDir, string $entity): string
     {
         try {
             $fullName = $this->entityUtils->getFullNameFromEntityName($entity);
         } catch (\LogicException) {
-            $fullName = '_NameSpaceNotFound/' . $entity;
+            $fullName = '_NameSpaceNotFound/'.$entity;
         }
 
-        $relativePath = str_replace('\\', '/', $fullName) . '.php';
+        $relativePath = str_replace('\\', '/', $fullName).'.php';
 
         return Path::join($snippetsDir, $relativePath);
     }
 
     /**
-     * Créé le fichier du snippet sur le disque
-     *
-     * @param PhpFile $phpFile
-     * @param string $fileName
-     * @return void
+     * Créé le fichier du snippet sur le disque.
      */
-    protected function writeSnippet(PhpFile $phpFile, string $fileName): void {
+    protected function writeSnippet(PhpFile $phpFile, string $fileName): void
+    {
         if (!is_dir(dirname($fileName))) {
             mkdir(dirname($fileName), 0777, true);
         }
 
-        $printer = new PsrPrinter;
+        $printer = new PsrPrinter();
 
         $content = $printer->printFile($phpFile);
         $content = $this->postProcessFileContent($content);
@@ -239,6 +227,7 @@ class SchemaSnippetsMaker
      * les classes d'entités à importer (pour le typage de ces propriétés).
      *
      * @param array<string, Difference> $differences
+     *
      * @return array<string>
      */
     protected function getEntityToImportFromRelations(array $differences): array
@@ -247,9 +236,9 @@ class SchemaSnippetsMaker
 
         foreach ($differences as $field => $difference) {
             if (
-                !is_array($difference->getExpectedType()) ||
-                !in_array(isset($difference->getExpectedType()['type']), [ClassMetadataInfo::ONE_TO_ONE, ClassMetadataInfo::MANY_TO_ONE]) ||
-                !isset($difference->getExpectedType()['targetEntity'])
+                !is_array($difference->getExpectedType())
+                || !in_array(isset($difference->getExpectedType()['type']), [ClassMetadataInfo::ONE_TO_ONE, ClassMetadataInfo::MANY_TO_ONE])
+                || !isset($difference->getExpectedType()['targetEntity'])
             ) {
                 continue;
             }
@@ -272,15 +261,12 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Obtient le namespace pour l'entité donnée
-     *
-     * @param string $entity
-     * @return string
+     * Obtient le namespace pour l'entité donnée.
      */
     protected function getNamespaceValue(string $entity): string
     {
         try {
-            $fullQualifiedName = str_contains($entity, "\\") ?
+            $fullQualifiedName = str_contains($entity, '\\') ?
                 $entity :
                 $this->entityUtils->getFullNameFromEntityName($entity);
 
@@ -292,7 +278,6 @@ class SchemaSnippetsMaker
 
     /**
      * @param array<string, string|array<string>> $type
-     * @return string
      */
     protected function getRelationTargetEntityName(array $type): string
     {
@@ -305,14 +290,13 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Construit l'objet PhpFile
-     * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/PhpFile.html
+     * Construit l'objet PhpFile.
      *
-     * @return PhpFile
+     * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/PhpFile.html
      */
     protected function makeFileSnippet(): PhpFile
     {
-        $file = new PhpFile;
+        $file = new PhpFile();
         $file->addComment('This file is auto-generated.');
         $file->setStrictTypes();
 
@@ -320,11 +304,9 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Construit l'objet PhpNamespace
-     * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/PhpNamespace.html
+     * Construit l'objet PhpNamespace.
      *
-     * @param string $entity
-     * @return PhpNamespace
+     * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/PhpNamespace.html
      */
     protected function makeNamespaceSnippet(string $entity): PhpNamespace
     {
@@ -340,10 +322,9 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Construit l'objet Property pour le champs 'id' d'une entité
-     * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/Property.html
+     * Construit l'objet Property pour le champs 'id' d'une entité.
      *
-     * @return Property
+     * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/Property.html
      */
     protected function makeIdPropertySnippet(): Property
     {
@@ -353,6 +334,7 @@ class SchemaSnippetsMaker
         $prop->addAttribute('ORM\Id');
         $prop->addAttribute('ORM\Column');
         $prop->addAttribute('ORM\GeneratedValue');
+
         return $prop;
     }
 
@@ -365,16 +347,12 @@ class SchemaSnippetsMaker
             'datetime' => '?\DateTimeInterface',
             'json_array' => 'array',
         ][$doctrineType] ?? 'mixed';
-
     }
 
     /**
-     * Make a Property object for a simple field (not a relation)
-     * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/Property.html
+     * Make a Property object for a simple field (not a relation).
      *
-     * @param string $name
-     * @param string $type
-     * @return Property
+     * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/Property.html
      */
     protected function makeSnippetEntitySimpleProp(string $name, string $type): Property
     {
@@ -387,7 +365,7 @@ class SchemaSnippetsMaker
         $prop = new Property($name);
         $prop->setProtected();
         $prop->setType($php_type);
-        $prop->setComment("-- Warning : auto-generated property, checkup the attribute options --");
+        $prop->setComment('-- Warning : auto-generated property, checkup the attribute options --');
 
         if ($type === 'text') {
             $prop->addAttribute(Column::class, ['length' => 255, 'options' => ['nullable' => true]]);
@@ -407,12 +385,11 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Make a Property object for a relation field
+     * Make a Property object for a relation field.
+     *
      * @see https://api.nette.org/php-generator/master/Nette/PhpGenerator/Property.html
      *
-     * @param string $name
      * @param array<mixed> $type
-     * @return Property
      */
     protected function makeSnippetEntityCollectionProp(string $name, array $type): Property
     {
@@ -421,12 +398,11 @@ class SchemaSnippetsMaker
         $prop->setType('Collection');
 
         if (
-            isset($type['type']) &&
-            $type['type'] === ClassMetadataInfo::ONE_TO_ONE || $type['type'] === ClassMetadataInfo::MANY_TO_ONE
+            isset($type['type'])
+            && $type['type'] === ClassMetadataInfo::ONE_TO_ONE || $type['type'] === ClassMetadataInfo::MANY_TO_ONE
         ) {
             $targetEntityName = $this->getRelationTargetEntityName($type);
             $prop->setType($targetEntityName);
-
         } else {
             $prop->setType(Collection::class);
         }
@@ -449,10 +425,9 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Make the attribute defining the relation (ex: #[ORM\ManyToMany(...)])
+     * Make the attribute defining the relation (ex: #[ORM\ManyToMany(...)]).
      *
      * @param array<string | array<string | array<string>>> $type
-     * @return Attribute
      */
     protected function makeRelationAttribute(array $type): Attribute
     {
@@ -462,7 +437,7 @@ class SchemaSnippetsMaker
         }
 
         if (isset($type['targetEntity'])) {
-            $options['targetEntity'] = $this->entityUtils->getEntityNameFromFullName($type['targetEntity']) . '::class';
+            $options['targetEntity'] = $this->entityUtils->getEntityNameFromFullName($type['targetEntity']).'::class';
         }
 
         if (isset($type['cascade'])) {
@@ -488,12 +463,12 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Make the #[ORM\JoinTable] attribute (if a definition exists)
+     * Make the #[ORM\JoinTable] attribute (if a definition exists).
      *
      * @param array<string | array<string | array<string>>> $type
-     * @return Attribute|null
      */
-    protected function makeJoinTableAttributes(array $type): ?Attribute {
+    protected function makeJoinTableAttributes(array $type): ?Attribute
+    {
         if (!isset($type['joinTable'])) {
             return null;
         }
@@ -512,10 +487,11 @@ class SchemaSnippetsMaker
      * Is `$inverse` is true, make the #[InverseJoinColumn] instead.
      *
      * @param array<string | array<string | array<string>>> $type
-     * @param bool $inverse
+     *
      * @return array<Attribute>
      */
-    protected function makeJoinColumnAttributes(array $type, bool $inverse = false): array {
+    protected function makeJoinColumnAttributes(array $type, bool $inverse = false): array
+    {
         $key = $inverse ? 'inverseJoinColumns' : 'joinColumns';
 
         $definition = $type[$key] ?? $type['joinTable'][$key] ?? [];
@@ -528,7 +504,7 @@ class SchemaSnippetsMaker
         foreach ($definition as $joinColDefinition) {
             $options = [];
 
-            if (isset($joinColDefinition['name']) && $joinColDefinition['name'] !== $type['fieldName'] . '_id') {
+            if (isset($joinColDefinition['name']) && $joinColDefinition['name'] !== $type['fieldName'].'_id') {
                 $options['name'] = $joinColDefinition['name'];
             }
             if (($joinColDefinition['unique'] ?? false) === true) {
@@ -562,42 +538,40 @@ class SchemaSnippetsMaker
     }
 
     /**
-     * Make the '__construct' method with collections initialization
+     * Make the '__construct' method with collections initialization.
+     *
      * @param array<Property> $collections
-     * @return Method
      */
-    protected function makeSnippetConstructor(array $collections): Method {
+    protected function makeSnippetConstructor(array $collections): Method
+    {
         $constructor = new Method('__construct');
         $constructor->setPublic();
 
         foreach ($collections as $collection) {
-            $constructor->addBody('$this->' . $collection->getName() . ' = new ArrayCollection();');
+            $constructor->addBody('$this->'.$collection->getName().' = new ArrayCollection();');
         }
 
         return $constructor;
     }
 
     /**
-     * Make a 'getter' method for the given property
-     *
-     * @param Property $prop
-     * @return Method
+     * Make a 'getter' method for the given property.
      */
-    protected function makeSnippetGetterForProp(Property $prop): Method {
-        $method = new Method('get' . ucfirst($prop->getName()));
+    protected function makeSnippetGetterForProp(Property $prop): Method
+    {
+        $method = new Method('get'.ucfirst($prop->getName()));
         $method->setReturnType($prop->getType());
-        $method->setBody('return $this->' . $prop->getName() . ';');
+        $method->setBody('return $this->'.$prop->getName().';');
+
         return $method;
     }
 
     /**
-     * Make a 'setter' method for the given property
-     *
-     * @param Property $prop
-     * @return Method
+     * Make a 'setter' method for the given property.
      */
-    protected function makeSnippetSetterForProp(Property $prop): Method {
-        $method = new Method('set' . ucfirst($prop->getName()));
+    protected function makeSnippetSetterForProp(Property $prop): Method
+    {
+        $method = new Method('set'.ucfirst($prop->getName()));
 
         $parameter = new Parameter($prop->getName());
         $parameter->setType($prop->getType());
@@ -608,11 +582,12 @@ class SchemaSnippetsMaker
             implode(
                 "\n",
                 [
-                    '$this->' . $prop->getName() . ' = $' . $prop->getName() . ';',
+                    '$this->'.$prop->getName().' = $'.$prop->getName().';',
                     'return $this;',
                 ]
             )
         );
+
         return $method;
     }
 
@@ -624,8 +599,8 @@ class SchemaSnippetsMaker
 
         foreach ($prop->getAttributes() as $attribute) {
             if (
-                $attribute instanceof Attribute &&
-                ($attribute->getName() === OneToMany::class || $attribute->getName() === ManyToMany::class)
+                $attribute instanceof Attribute
+                && ($attribute->getName() === OneToMany::class || $attribute->getName() === ManyToMany::class)
             ) {
                 $targetEntityName = $attribute->getArguments()['targetEntity'];
                 if (!$targetEntityName) {
@@ -642,9 +617,11 @@ class SchemaSnippetsMaker
                         return null;
                     }
                 }
+
                 return $targetEntityName;
             }
         }
+
         return null;
     }
 
@@ -664,12 +641,12 @@ class SchemaSnippetsMaker
         }
 
         if (!$relationAttr) {
-            throw new \LogicException('Missing relation attribute for collection property ' . $prop->getName());
+            throw new \LogicException('Missing relation attribute for collection property '.$prop->getName());
         }
 
         $inversedBy = $relationAttr->getArguments()['inversedBy'] ?? $relationAttr->getArguments()['mappedBy'] ?? null;
         if (!$inversedBy) {
-            var_dump('Could not determine the inverse prop for collection property ' . $prop->getName());
+            var_dump('Could not determine the inverse prop for collection property '.$prop->getName());
             $inversedBy = 'XXXX';
         }
 
@@ -683,22 +660,19 @@ class SchemaSnippetsMaker
         }
 
         return
-            $prefix .
-            ucfirst($inversedBy) .
+            $prefix.
+            ucfirst($inversedBy).
             (($prefix === 'set' && $isRemoving) ? '(null)' : '($this)');
     }
 
     /**
-     * Make an 'adder' method for the given property
-     *
-     * @param Property $prop
-     * @return Method
+     * Make an 'adder' method for the given property.
      */
-    protected function makeSnippetAdderForCollection(Property $prop): Method {
-
+    protected function makeSnippetAdderForCollection(Property $prop): Method
+    {
         $singularPropName = $this->singularize($prop->getName());
 
-        $method = new Method('add' . ucfirst($singularPropName));
+        $method = new Method('add'.ucfirst($singularPropName));
 
         $targetEntityName = $this->getTargetEntityNameFromCollectionProp($prop);
 
@@ -712,26 +686,25 @@ class SchemaSnippetsMaker
         $method->setBody(implode(
             "\n",
             [
-                'if (!$this->' . $prop->getName() . '->contains($' . $singularPropName . ')) {',
-                '    $this->' . $prop->getName() . '[] = $' . $singularPropName . ';',
-                '    $' . $singularPropName . '->' . $inverseSetterCall . ';',
+                'if (!$this->'.$prop->getName().'->contains($'.$singularPropName.')) {',
+                '    $this->'.$prop->getName().'[] = $'.$singularPropName.';',
+                '    $'.$singularPropName.'->'.$inverseSetterCall.';',
                 '}',
                 '',
                 'return $this;',
             ]));
+
         return $method;
     }
 
     /**
-     * Make a 'remover' method for the given property
-     *
-     * @param Property $prop
-     * @return Method
+     * Make a 'remover' method for the given property.
      */
-    protected function makeSnippetRemoverForCollection(Property $prop): Method {
+    protected function makeSnippetRemoverForCollection(Property $prop): Method
+    {
         $singularPropName = $this->singularize($prop->getName());
 
-        $method = new Method('remove' . ucfirst($singularPropName));
+        $method = new Method('remove'.ucfirst($singularPropName));
 
         $targetEntityName = $this->getTargetEntityNameFromCollectionProp($prop);
 
@@ -746,29 +719,28 @@ class SchemaSnippetsMaker
             implode(
                 "\n",
                 [
-                    'if ($this->' . $prop->getName() . '->removeElement($' . $singularPropName . ')) {',
-                    '    $' . $singularPropName . '->' . $inverseSetterCall . ';',
+                    'if ($this->'.$prop->getName().'->removeElement($'.$singularPropName.')) {',
+                    '    $'.$singularPropName.'->'.$inverseSetterCall.';',
                     '}',
                     '',
                     'return $this;',
                 ]
             )
         );
+
         return $method;
     }
 
     /**
-     * Perform some post-fixes on the file content
-     *
-     * @param string $content
-     * @return string
+     * Perform some post-fixes on the file content.
      */
     protected function postProcessFileContent(string $content): string
     {
-        return preg_replace("/targetEntity: '(\w+)::class'/", "targetEntity: $1::class", $content);
+        return preg_replace("/targetEntity: '(\w+)::class'/", 'targetEntity: $1::class', $content);
     }
 
-    protected function singularize(string $name): string {
+    protected function singularize(string $name): string
+    {
         $exceptions = ['access'];
         if (in_array(strtolower($name), $exceptions)) {
             return $name;

+ 2 - 0
src/Service/Doctrine/SchemaValidation/SchemaValidationService.php

@@ -287,6 +287,7 @@ class SchemaValidationService
 
     /**
      * @param array<Difference|array<Difference>> $diff
+     *
      * @return array<string>
      */
     public function formatToCsv(array $diff): array
@@ -301,6 +302,7 @@ class SchemaValidationService
                 }
             }
         }
+
         return $csv;
     }
 }