Vincent GUFFON 4 years ago
parent
commit
2600fb5cf0

+ 6 - 1
src/Entity/Core/BankAccount.php

@@ -77,6 +77,8 @@ class BankAccount
 
     #[ORM\ManyToMany(targetEntity: Organization::class, inversedBy: 'bankAccounts')]
     #[ORM\JoinTable(name: 'organization_bankaccount')]
+    #[ORM\JoinColumn(name: 'bankAccount_id', referencedColumnName: 'id', unique: true)]
+    #[ORM\InverseJoinColumn(name: 'organization_id', referencedColumnName: 'id')]
     private Collection $organization;
 
     #[Pure] public function __construct()
@@ -218,6 +220,7 @@ class BankAccount
     {
         if (!$this->organization->contains($organization)) {
             $this->organization[] = $organization;
+            $organization->addBankAccount($this);
         }
 
         return $this;
@@ -225,7 +228,9 @@ class BankAccount
 
     public function removeOrganization(Organization $organization): self
     {
-        $this->organization->removeElement($organization);
+        if ($this->organization->removeElement($organization)) {
+            $organization->removeBankAccount($this);
+        }
 
         return $this;
     }

+ 1 - 1
src/Repository/Cotisation/CotisationApiResourcesRepository.php

@@ -30,7 +30,7 @@ class CotisationApiResourcesRepository
         $result = $query->getOneOrNullResult();
 
         if (!empty($result)) {
-            return $result['oa_miscellaneous_state_sta'];
+            return intval($result['oa_miscellaneous_state_sta']);
         }
         return null;
     }

+ 0 - 0
src/Serializer/ApiNormalizer.php → src/Serializer/DefaultNormalizer.php