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

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