<?php
declare(strict_types=1);
namespace App\Entity\System;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(
* uniqueConstraints={
*
* @ORM\UniqueConstraint(name="uk_product_product_attribute_reference", columns={"product_id", "product_attribute_id", "reference"})
* }
* )
*
* @ORM\Entity(repositoryClass="App\Repository\System\ProductStockRepository")
*/
class ProductStock
{
public const JIT_MIN_DAYS = 1;
public const JIT_MAX_DAYS = 2;
public const JIT_3_5_MIN_DAYS = 3;
public const JIT_3_5_MAX_DAYS = 5;
public const IMMEDIATE_STOCK_MIN_DAYS = 0;
public const IMMEDIATE_STOCK_MAX_DAYS = 0;
public const STOCK_WITHOUT_PURCHASE_ID_REFERENCE = '0';
/**
* @ORM\Column(type="integer")
*
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected int $id;
/**
* @ORM\Column(type="string", length=32, unique=true, nullable=true)
*/
protected ?string $reference;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\System\Product", inversedBy="productStocks", cascade={"persist"})
*
* @ORM\JoinColumn(referencedColumnName="id_product", nullable=false)
*/
private Product $product;
/**
* @ORM\ManyToOne(targetEntity="ProductAttribute", cascade={"persist"})
*
* @ORM\JoinColumn(referencedColumnName="id_product_attribute")
*/
private ?ProductAttribute $productAttribute;
/**
* @ORM\Column(type="integer", nullable=false, options={"default":0})
*/
private int $originalQuantity = 0;
/**
* @ORM\Column(type="integer", nullable=false, options={"default":0})
*/
private int $quantity = 0;
/**
* @ORM\Column(type="integer", nullable=false, options={"default":0})
*/
private int $quantityPurchased = 0;
/**
* @ORM\Column(type="integer")
*/
private int $minimumHandlingDays;
/**
* @ORM\Column(type="integer")
*/
private int $maximumHandlingDays;
/**
* @ORM\Column(type="datetime")
*/
private \DateTime $dateAdd;
/**
* @ORM\Column(type="datetime")
*/
private \DateTime $dateUpdate;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default":0})
*/
private bool $purchaseAvailable;
/**
* @var Warehouse
*
* @ORM\ManyToOne(targetEntity="App\Entity\System\Warehouse")
*
* @ORM\JoinColumn(name="warehouse_id", referencedColumnName="id", nullable=false, options={"default":1})
*/
private $warehouse;
public function __construct()
{
$this->dateAdd = new \DateTime();
$this->dateUpdate = new \DateTime();
$this->purchaseAvailable = false;
}
public function getId(): int
{
return $this->id;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(?string $reference): ProductStock
{
$this->reference = $reference;
return $this;
}
public function getProduct(): Product
{
return $this->product;
}
public function setProduct(Product $product): ProductStock
{
$this->product = $product;
return $this;
}
public function getProductAttribute(): ?ProductAttribute
{
return $this->productAttribute;
}
public function setProductAttribute(?ProductAttribute $productAttribute): ProductStock
{
$this->productAttribute = $productAttribute;
return $this;
}
public function getQuantity(): int
{
return $this->quantity;
}
public function setQuantity(int $quantity): ProductStock
{
$this->quantity = $quantity;
return $this;
}
public function getMinimumHandlingDays(): int
{
return $this->minimumHandlingDays;
}
public function setMinimumHandlingDays(int $minimumHandlingDays): ProductStock
{
$this->minimumHandlingDays = $minimumHandlingDays;
return $this;
}
public function getMaximumHandlingDays(): int
{
return $this->maximumHandlingDays;
}
public function setMaximumHandlingDays(int $maximumHandlingDays): ProductStock
{
$this->maximumHandlingDays = $maximumHandlingDays;
return $this;
}
public function getDateAdd(): \DateTime
{
return $this->dateAdd;
}
public function setDateAdd(\DateTime $dateAdd): ProductStock
{
$this->dateAdd = $dateAdd;
return $this;
}
public function getDateUpdate(): \DateTime
{
return $this->dateUpdate;
}
public function setDateUpdate(\DateTime $dateUpdate): ProductStock
{
$this->dateUpdate = $dateUpdate;
return $this;
}
public function getOriginalQuantity(): int
{
return $this->originalQuantity;
}
public function setOriginalQuantity(int $originalQuantity): ProductStock
{
$this->originalQuantity = $originalQuantity;
return $this;
}
public function getQuantityPurchased(): int
{
return $this->quantityPurchased;
}
public function setQuantityPurchased(int $quantityPurchased): ProductStock
{
$this->quantityPurchased = $quantityPurchased;
return $this;
}
public function getWarehouse(): Warehouse
{
return $this->warehouse;
}
public function setWarehouse(Warehouse $warehouse): void
{
$this->warehouse = $warehouse;
}
public function isPurchaseAvailable(): bool
{
return $this->purchaseAvailable;
}
public function setPurchaseAvailable(bool $purchaseAvailable): ProductStock
{
$this->purchaseAvailable = $purchaseAvailable;
return $this;
}
}