|
|
@@ -5,6 +5,9 @@ namespace App\ApiResources\Dolibarr;
|
|
|
|
|
|
use ApiPlatform\Core\Annotation\ApiProperty;
|
|
|
use ApiPlatform\Core\Annotation\ApiResource;
|
|
|
+use Doctrine\Common\Collections\ArrayCollection;
|
|
|
+use Doctrine\Common\Collections\Collection;
|
|
|
+use JetBrains\PhpStorm\Pure;
|
|
|
use Symfony\Component\Serializer\Annotation\Groups;
|
|
|
|
|
|
/**
|
|
|
@@ -57,22 +60,29 @@ class DolibarrAccount
|
|
|
* Contract and services currently active
|
|
|
*/
|
|
|
#[Groups('dolibarr_get')]
|
|
|
- private ?object $contract = null;
|
|
|
+ private ?DolibarrContract $contract = null;
|
|
|
|
|
|
/**
|
|
|
* Last bills
|
|
|
*/
|
|
|
#[Groups('dolibarr_get')]
|
|
|
- private array $bills = [];
|
|
|
+ private Collection $bills;
|
|
|
+
|
|
|
+ #[Pure]
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ $this->bills = new ArrayCollection();
|
|
|
+ }
|
|
|
|
|
|
public function getOrganizationId(): int
|
|
|
{
|
|
|
return $this->organizationId;
|
|
|
}
|
|
|
|
|
|
- public function setOrganizationId(int $organizationId): void
|
|
|
+ public function setOrganizationId(int $organizationId): self
|
|
|
{
|
|
|
$this->organizationId = $organizationId;
|
|
|
+ return $this;
|
|
|
}
|
|
|
|
|
|
public function getSocId(): int
|
|
|
@@ -80,9 +90,10 @@ class DolibarrAccount
|
|
|
return $this->socId;
|
|
|
}
|
|
|
|
|
|
- public function setSocId(int $socId): void
|
|
|
+ public function setSocId(int $socId): self
|
|
|
{
|
|
|
$this->socId = $socId;
|
|
|
+ return $this;
|
|
|
}
|
|
|
|
|
|
public function getClientNumber(): string
|
|
|
@@ -90,9 +101,10 @@ class DolibarrAccount
|
|
|
return $this->clientNumber;
|
|
|
}
|
|
|
|
|
|
- public function setClientNumber(string $clientNumber): void
|
|
|
+ public function setClientNumber(string $clientNumber): self
|
|
|
{
|
|
|
$this->clientNumber = $clientNumber;
|
|
|
+ return $this;
|
|
|
}
|
|
|
|
|
|
public function getProduct(): string
|
|
|
@@ -100,9 +112,10 @@ class DolibarrAccount
|
|
|
return $this->product;
|
|
|
}
|
|
|
|
|
|
- public function setProduct(string $product): void
|
|
|
+ public function setProduct(string $product): self
|
|
|
{
|
|
|
$this->product = $product;
|
|
|
+ return $this;
|
|
|
}
|
|
|
|
|
|
public function getContract(): ?object
|
|
|
@@ -110,24 +123,26 @@ class DolibarrAccount
|
|
|
return $this->contract;
|
|
|
}
|
|
|
|
|
|
- public function setContract(?object $contract): void
|
|
|
+ public function setContract(?object $contract): self
|
|
|
{
|
|
|
$this->contract = $contract;
|
|
|
+ return $this;
|
|
|
}
|
|
|
|
|
|
- public function getBills(): array
|
|
|
+ public function getBills(): Collection
|
|
|
{
|
|
|
return $this->bills;
|
|
|
}
|
|
|
|
|
|
- public function setBills(array $bills): void
|
|
|
+ public function addBill(DolibarrBill $bill): self
|
|
|
{
|
|
|
- $this->bills = $bills;
|
|
|
+ $this->bills[] = $bill;
|
|
|
+ return $this;
|
|
|
}
|
|
|
|
|
|
- public function addBill(DolibarrBill $bill): void
|
|
|
+ public function removeBill(DolibarrBill $bill): self
|
|
|
{
|
|
|
- $this->bills[] = $bill;
|
|
|
+ $this->bills->removeElement($bill);
|
|
|
+ return $this;
|
|
|
}
|
|
|
-
|
|
|
}
|