| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- declare(strict_types=1);
- namespace App\ApiResources\Dolibarr;
- use ApiPlatform\Metadata\ApiProperty;
- use ApiPlatform\Metadata\ApiResource;
- use ApiPlatform\Metadata\Get;
- use App\ApiResources\ApiResourcesInterface;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use JetBrains\PhpStorm\Pure;
- use Symfony\Component\Serializer\Annotation\Groups;
- /**
- * Contract of a society, retrieved from dolibarr.
- */
- #[ApiResource(
- operations: [
- new Get(),
- ]
- )]
- class DolibarrContract implements ApiResourcesInterface
- {
- /**
- * Reference of the dolibarr contract.
- */
- #[ApiProperty(identifier: true)]
- #[Groups('dolibarr_get')]
- private string $ref;
- /**
- * Id of the society.
- */
- #[Groups('dolibarr_get')]
- private int $socId;
- /**
- * Lines (services) included in the current contract.
- */
- #[Groups('dolibarr_get')]
- private Collection $lines;
- #[Pure]
- public function __construct()
- {
- $this->lines = new ArrayCollection();
- }
- public function getRef(): string
- {
- return $this->ref;
- }
- public function setRef(string $ref): self
- {
- $this->ref = $ref;
- return $this;
- }
- public function getSocId(): int
- {
- return $this->socId;
- }
- public function setSocId(int $socId): self
- {
- $this->socId = $socId;
- return $this;
- }
- public function getLines(): Collection
- {
- return $this->lines;
- }
- public function addLine(DolibarrContractLine $line): self
- {
- $this->lines[] = $line;
- return $this;
- }
- public function removeBill(DolibarrContractLine $line): self
- {
- $this->lines->removeElement($line);
- return $this;
- }
- }
|