src/JanusHercules/IntegratedExternalPartnerCustomers/Domain/Entity/WeclappCostItem.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_cost_items')]
  7. class WeclappCostItem
  8. {
  9. public function __construct(
  10. string $id,
  11. WeclappContract $weclappContract,
  12. int $articleId,
  13. float $netAmount,
  14. int $discountPercentage
  15. ) {
  16. $this->id = $id;
  17. $this->weclappContract = $weclappContract;
  18. $this->articleId = $articleId;
  19. $this->netAmount = $netAmount;
  20. $this->discountPercentage = $discountPercentage;
  21. }
  22. #[ORM\Id]
  23. #[ORM\Column(
  24. type: Types::STRING
  25. )]
  26. private string $id; // yes, all weclapp IDs are seemingly numeric, but the API defines them as type string
  27. public function getId(): string
  28. {
  29. return $this->id;
  30. }
  31. #[ORM\ManyToOne(
  32. targetEntity: WeclappContract::class,
  33. cascade : ['persist']
  34. )]
  35. #[ORM\JoinColumn(
  36. name : 'weclapp_contracts_id',
  37. referencedColumnName: 'id',
  38. onDelete : 'CASCADE'
  39. )]
  40. private WeclappContract $weclappContract;
  41. public function getWeclappContract(): WeclappContract
  42. {
  43. return $this->weclappContract;
  44. }
  45. public function setWeclappContract(WeclappContract $weclappContract): void
  46. {
  47. $this->weclappContract = $weclappContract;
  48. }
  49. #[ORM\Column(
  50. type: Types::INTEGER
  51. )]
  52. private int $articleId;
  53. public function getArticleId(): int
  54. {
  55. return $this->articleId;
  56. }
  57. public function setArticleId(int $articleId): void
  58. {
  59. $this->articleId = $articleId;
  60. }
  61. #[ORM\Column(
  62. type: Types::FLOAT
  63. )]
  64. private float $netAmount;
  65. public function getNetAmount(): float
  66. {
  67. return $this->netAmount;
  68. }
  69. public function setNetAmount(float $netAmount): void
  70. {
  71. $this->netAmount = $netAmount;
  72. }
  73. #[ORM\Column(
  74. type: Types::INTEGER
  75. )]
  76. private int $discountPercentage;
  77. public function getDiscountPercentage(): int
  78. {
  79. return $this->discountPercentage;
  80. }
  81. public function setDiscountPercentage(int $discountPercentage): void
  82. {
  83. $this->discountPercentage = $discountPercentage;
  84. }
  85. }