src/Domain/Catalog/Entities/Product.php line 32

Open in your IDE?
  1. <?php
  2. // src/Domain/Catalog/Entities/Product.php
  3. namespace App\Domain\Catalog\Entities;
  4. /**
  5. * @author rbellorin@sumagroups.com
  6. * @version 2026-02-11
  7. */
  8. final class Product
  9. {
  10. private int $m_productprice_id;
  11. private int $m_product_id;
  12. private int $m_pricelist_version_id;
  13. private int $sm_marca_id;
  14. private string $code;
  15. private string $sku;
  16. private string $name;
  17. private float $price;
  18. private float $price_list;
  19. private float $price_std;
  20. private float $price_limit;
  21. private float $price_promo;
  22. private ?string $description;
  23. private ?string $brand = null;
  24. private ?string $imagePath;// opcional (ruta local o URL)
  25. private string $category;
  26. private int $qty;
  27. private int $qty_arrive;
  28. private ?string $comercialname;
  29. private ?string $allegation;
  30. public function __construct(
  31. int $m_productprice_id,
  32. int $m_product_id,
  33. int $m_pricelist_version_id,
  34. int $sm_marca_id,
  35. string $code,
  36. string $sku,
  37. string $name,
  38. float $price,
  39. float $price_list,
  40. float $price_std,
  41. float $price_limit,
  42. float $price_promo,
  43. ?string $description,
  44. ?string $brand = null,
  45. ?string $imagePath,// opcional (ruta local o URL)
  46. string $category,
  47. int $qty,
  48. int $qty_arrive,
  49. ?string $comercialname,
  50. ?string $allegation
  51. ) {
  52. $this->m_productprice_id = $m_productprice_id;
  53. $this->m_product_id = $m_product_id;
  54. $this->m_pricelist_version_id = $m_pricelist_version_id;
  55. $this->sm_marca_id = $sm_marca_id;
  56. $this->code = $code;
  57. $this->sku = $sku;
  58. $this->name = $name;
  59. $this->price = $price;
  60. $this->price_list = $price_list;
  61. $this->price_std = $price_std;
  62. $this->price_limit = $price_limit;
  63. $this->price_promo = $price_promo;
  64. $this->description = $description;
  65. $this->brand = $brand;
  66. $this->imagePath = $imagePath;
  67. $this->category = $category;
  68. $this->qty = $qty;
  69. $this->qty_arrive = $qty_arrive;
  70. $this->comercialname = $comercialname;
  71. $this->allegation = $allegation;
  72. }
  73. public function getMProductId(): int { return $this->m_product_id; }
  74. public function getMPricelistVersionId(): int { return $this->m_pricelist_version_id; }
  75. public function getMProductPriceId(): ?int { return $this->m_productprice_id; }
  76. public function getSmMarcaId(): ?int { return $this->sm_marca_id; }
  77. public function getCode(): ?string { return $this->code; }
  78. public function getSku(): ?string { return $this->sku; }
  79. public function getName(): ?string { return $this->name; }
  80. public function getPrice(): float { return $this->price; }
  81. public function getPriceList(): float { return $this->price_list; }
  82. public function getPriceLimit(): float { return $this->price_limit; }
  83. public function getPricePromo(): float { return $this->price_promo; }
  84. public function getDescription(): string { return $this->description; }
  85. public function getBrand(): ?string { return $this->brand; }
  86. public function getCategory(): ?string { return $this->category; }
  87. public function getImagePath(): string { return $this->imagePath; }
  88. public function getQty(): ?int { return $this->qty; }
  89. public function getQtyArrive(): ?int { return $this->qty_arrive; }
  90. public function getQtyTotal(): ?int { return $this->qty + $this->qty_arrive; }
  91. public function getImage(): string {
  92. return $this->imagePath ?? '';
  93. }
  94. public function getComercialName() : string {
  95. return $this->comercialname ?? '*';
  96. }
  97. public function getAllegation() : string {
  98. if (!$this->allegation){
  99. return "Sin datos";
  100. }
  101. return $this->allegation;
  102. }
  103. /**Setter */
  104. public function setBrand(string $value) : void {
  105. $this->brand = $value;
  106. }
  107. public function setCategory(string $value) : void {
  108. $this->category = $value;
  109. }
  110. public function setSmMarcaId(int $value) : void {
  111. $this->sm_marca_id = $value;
  112. }
  113. }