| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- declare (strict_types=1);
- namespace App\ApiResources\Dolibarr;
- use ApiPlatform\Metadata\Get;
- use ApiPlatform\Metadata\ApiResource;
- use ApiPlatform\Metadata\ApiProperty;
- 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;
- }
- }
|