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

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. private ?int $m_product_category_id;
  31. public function __construct(
  32. int $m_productprice_id,
  33. int $m_product_id,
  34. int $m_pricelist_version_id,
  35. int $sm_marca_id,
  36. string $code,
  37. string $sku,
  38. string $name,
  39. float $price,
  40. float $price_list,
  41. float $price_std,
  42. float $price_limit,
  43. float $price_promo,
  44. ?string $description,
  45. ?string $brand = null,
  46. ?string $imagePath,// opcional (ruta local o URL)
  47. string $category,
  48. int $qty,
  49. int $qty_arrive,
  50. ?string $comercialname,
  51. ?string $allegation,
  52. ?int $m_product_category_id = null
  53. ) {
  54. $this->m_productprice_id = $m_productprice_id;
  55. $this->m_product_id = $m_product_id;
  56. $this->m_pricelist_version_id = $m_pricelist_version_id;
  57. $this->sm_marca_id = $sm_marca_id;
  58. $this->code = $code;
  59. $this->sku = $sku;
  60. $this->name = $name;
  61. $this->price = $price;
  62. $this->price_list = $price_list;
  63. $this->price_std = $price_std;
  64. $this->price_limit = $price_limit;
  65. $this->price_promo = $price_promo;
  66. $this->description = $description;
  67. $this->brand = $brand;
  68. $this->imagePath = $imagePath;
  69. $this->category = $category;
  70. $this->qty = $qty;
  71. $this->qty_arrive = $qty_arrive;
  72. $this->comercialname = $comercialname;
  73. $this->allegation = $allegation;
  74. $this->m_product_category_id = $m_product_category_id;
  75. }
  76. public function getMProductId(): int { return $this->m_product_id; }
  77. public function getMPricelistVersionId(): int { return $this->m_pricelist_version_id; }
  78. public function getMProductPriceId(): ?int { return $this->m_productprice_id; }
  79. public function getSmMarcaId(): ?int { return $this->sm_marca_id; }
  80. public function getCode(): ?string { return $this->code; }
  81. public function getSku(): ?string { return $this->sku; }
  82. public function getName(): ?string { return $this->name; }
  83. public function getPrice(): float { return $this->price; }
  84. public function getPriceList(): float { return $this->price_list; }
  85. public function getPriceLimit(): float { return $this->price_limit; }
  86. public function getPricePromo(): float { return $this->price_promo; }
  87. public function getDescription(): string { return $this->description; }
  88. public function getBrand(): ?string { return $this->brand; }
  89. public function getCategory(): ?string { return $this->category; }
  90. public function getMProductCategoryId(): ?int { return $this->m_product_category_id; }
  91. public function getImagePath(): string { return $this->imagePath; }
  92. public function getQty(): ?int { return $this->qty; }
  93. public function getQtyArrive(): ?int { return $this->qty_arrive; }
  94. public function getQtyTotal(): ?int { return $this->qty + $this->qty_arrive; }
  95. public function getImage(): string {
  96. return $this->imagePath ?? '';
  97. }
  98. public function getComercialName() : string {
  99. return $this->comercialname ?? '*';
  100. }
  101. public function getAllegation() : string {
  102. if (!$this->allegation){
  103. return "Sin datos";
  104. }
  105. return $this->allegation;
  106. }
  107. /**Setter */
  108. public function setBrand(string $value) : void {
  109. $this->brand = $value;
  110. }
  111. public function setCategory(string $value) : void {
  112. $this->category = $value;
  113. }
  114. public function setSmMarcaId(int $value) : void {
  115. $this->sm_marca_id = $value;
  116. }
  117. }