src/JanusHercules/IntegratedExternalPartnerCustomers/Domain/Entity/WeclappContractItem.php line 10

Open in your IDE?
  1. <?php
  2. namespace JanusHercules\IntegratedExternalPartnerCustomers\Domain\Entity;
  3. use Doctrine\DBAL\Types\Types;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity]
  6. #[ORM\Table(name: 'weclapp_contract_items')]
  7. class WeclappContractItem
  8. {
  9. public function __construct(
  10. string $id,
  11. WeclappContract $weclappContract,
  12. string $title,
  13. float $unitPrice,
  14. int $discountPercentage,
  15. ?int $numberOfJobs = null
  16. ) {
  17. $this->id = $id;
  18. $this->weclappContract = $weclappContract;
  19. $this->title = $title;
  20. $this->unitPrice = $unitPrice;
  21. $this->discountPercentage = $discountPercentage;
  22. $this->numberOfJobs = $numberOfJobs;
  23. }
  24. #[ORM\Id]
  25. #[ORM\Column(
  26. type: Types::STRING
  27. )]
  28. private string $id; // yes, all weclapp IDs are seemingly numeric, but the API defines them as type string
  29. public function getId(): string
  30. {
  31. return $this->id;
  32. }
  33. #[ORM\ManyToOne(
  34. targetEntity: WeclappContract::class,
  35. cascade : ['persist']
  36. )]
  37. #[ORM\JoinColumn(
  38. name : 'weclapp_contracts_id',
  39. referencedColumnName: 'id',
  40. onDelete : 'CASCADE'
  41. )]
  42. private WeclappContract $weclappContract;
  43. public function getWeclappContract(): WeclappContract
  44. {
  45. return $this->weclappContract;
  46. }
  47. public function setWeclappContract(WeclappContract $weclappContract): void
  48. {
  49. $this->weclappContract = $weclappContract;
  50. }
  51. public function setDiscountPercentage(int $discountPercentage): void
  52. {
  53. $this->discountPercentage = $discountPercentage;
  54. }
  55. #[ORM\Column(
  56. type: Types::STRING
  57. )]
  58. private string $title;
  59. public function getTitle(): string
  60. {
  61. return $this->title;
  62. }
  63. public function setTitle(string $title): void
  64. {
  65. $this->title = $title;
  66. }
  67. #[ORM\Column(
  68. type: Types::FLOAT
  69. )]
  70. private float $unitPrice;
  71. public function getUnitPrice(): float
  72. {
  73. return $this->unitPrice;
  74. }
  75. public function setUnitPrice(float $unitPrice): void
  76. {
  77. $this->unitPrice = $unitPrice;
  78. }
  79. #[ORM\Column(
  80. type: Types::INTEGER
  81. )]
  82. private int $discountPercentage;
  83. public function getDiscountPercentage(): int
  84. {
  85. return $this->discountPercentage;
  86. }
  87. #[ORM\Column(
  88. type : Types::INTEGER,
  89. nullable: true
  90. )]
  91. private ?int $numberOfJobs;
  92. public function getNumberOfJobs(): ?int
  93. {
  94. return $this->numberOfJobs;
  95. }
  96. public function setNumberOfJobs(?int $numberOfJobs): void
  97. {
  98. $this->numberOfJobs = $numberOfJobs;
  99. }
  100. }