DolibarrContractLine.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\ApiResources\Dolibarr;
  4. use ApiPlatform\Core\Annotation\ApiProperty;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8. * Lines (services) included in a society contract, as retrieved from dolibarr
  9. */
  10. #[ApiResource(
  11. collectionOperations: [
  12. 'get' => [
  13. 'method' => 'GET',
  14. 'path' => '/dolibarr/contract-lines/{contractId}',
  15. 'requirements' => ['contractId' => '\d+'],
  16. 'normalization_context' => [
  17. 'groups' => ['dolibarr_get']
  18. ]
  19. ],
  20. ]
  21. )]
  22. class DolibarrContractLine
  23. {
  24. #[ApiProperty(identifier: true)]
  25. #[Groups('dolibarr_get')]
  26. private int $id;
  27. /**
  28. * Id of the contract's line
  29. */
  30. #[Groups('dolibarr_get')]
  31. private int $contractId;
  32. /**
  33. * Reference of the contracted service ( = product's reference)
  34. */
  35. #[Groups('dolibarr_get')]
  36. private string $serviceRef;
  37. /**
  38. * Label of the contracted service
  39. */
  40. #[Groups('dolibarr_get')]
  41. private string $serviceLabel;
  42. /**
  43. * Service active from date ...
  44. */
  45. #[Groups('dolibarr_get')]
  46. private \DateTime $dateStart;
  47. /**
  48. * Service active to date ...
  49. */
  50. #[Groups('dolibarr_get')]
  51. private \DateTime $dateEnd;
  52. public function getId(): int
  53. {
  54. return $this->id;
  55. }
  56. public function setId(int $id): void
  57. {
  58. $this->id = $id;
  59. }
  60. public function getContractId(): int
  61. {
  62. return $this->contractId;
  63. }
  64. public function setContractId(int $contractId): void
  65. {
  66. $this->contractId = $contractId;
  67. }
  68. public function getServiceRef(): string
  69. {
  70. return $this->serviceRef;
  71. }
  72. public function setServiceRef(string $serviceRef): void
  73. {
  74. $this->serviceRef = $serviceRef;
  75. }
  76. public function getServiceLabel(): string
  77. {
  78. return $this->serviceLabel;
  79. }
  80. public function setServiceLabel(string $serviceLabel): void
  81. {
  82. $this->serviceLabel = $serviceLabel;
  83. }
  84. public function getDateStart(): \DateTime
  85. {
  86. return $this->dateStart;
  87. }
  88. public function setDateStart(\DateTime $dateStart): void
  89. {
  90. $this->dateStart = $dateStart;
  91. }
  92. public function isDateEnd(): \DateTime
  93. {
  94. return $this->dateEnd;
  95. }
  96. public function setDateEnd(\DateTime $dateEnd): void
  97. {
  98. $this->dateEnd = $dateEnd;
  99. }
  100. }