src/Entity/Product.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ProductRepository::class)
  9.  */
  10. class Product
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $label;
  22.     /**
  23.      * @ORM\Column(type="string", length=50)
  24.      */
  25.     private $unit;
  26.     /**
  27.      * @ORM\Column(type="integer", nullable=true)
  28.      */
  29.     private $expirationDelay;
  30.     /**
  31.      * @ORM\Column(type="integer", nullable=true)
  32.      */
  33.     private $stockLimit;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=Category::class, inversedBy="products")
  36.      * @ORM\JoinColumn(nullable=false)
  37.      */
  38.     private $category;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=SubCategory::class, inversedBy="products")
  41.      */
  42.     private $subCategory;
  43.     /**
  44.      * @ORM\Column(type="datetime")
  45.      */
  46.     private $creation_date;
  47.     /**
  48.      * @ORM\OneToMany(targetEntity=Stock::class, mappedBy="product", orphanRemoval=true)
  49.      */
  50.     private $stocks;
  51.     /**
  52.      * @ORM\OneToMany(targetEntity=SaleItems::class, mappedBy="product")
  53.      */
  54.     private $saleItems;
  55.     /**
  56.      * @ORM\OneToMany(targetEntity=DiscountProducts::class, mappedBy="product")
  57.      */
  58.     private $discountedProducts;
  59.     /**
  60.      * @ORM\Column(type="boolean")
  61.      */
  62.     private $shortcut;
  63.     /**
  64.      * @ORM\OneToMany(targetEntity=Notifications::class, mappedBy="product_id")
  65.      */
  66.     private $notifications;
  67.     /**
  68.      * @ORM\Column(type="string", length=255)
  69.      */
  70.     private $target;
  71.     /**
  72.      * @ORM\Column(type="boolean")
  73.      */
  74.     private $isSynch;
  75.     /**
  76.      * @ORM\Column(type="boolean")
  77.      */
  78.     private $deleted 0;
  79.     public function __construct()
  80.     {
  81.         $this->stocks = new ArrayCollection();
  82.         $this->saleItems = new ArrayCollection();
  83.         $this->discountedProducts = new ArrayCollection();
  84.         $this->notifications = new ArrayCollection();
  85.     }
  86.     public function getId(): ?int
  87.     {
  88.         return $this->id;
  89.     }
  90.     public function getLabel(): ?string
  91.     {
  92.         return $this->label;
  93.     }
  94.     public function setLabel(string $label): self
  95.     {
  96.         $this->label $label;
  97.         return $this;
  98.     }
  99.     public function getUnit(): ?string
  100.     {
  101.         return $this->unit;
  102.     }
  103.     public function setUnit(string $unit): self
  104.     {
  105.         $this->unit $unit;
  106.         return $this;
  107.     }
  108.     public function getExpirationDelay(): ?int
  109.     {
  110.         return $this->expirationDelay;
  111.     }
  112.     public function setExpirationDelay(?int $expirationDelay): self
  113.     {
  114.         $this->expirationDelay $expirationDelay;
  115.         return $this;
  116.     }
  117.     public function getStockLimit(): ?int
  118.     {
  119.         return $this->stockLimit;
  120.     }
  121.     public function setStockLimit(?int $stockLimit): self
  122.     {
  123.         $this->stockLimit $stockLimit;
  124.         return $this;
  125.     }
  126.     public function getCategory(): ?Category
  127.     {
  128.         return $this->category;
  129.     }
  130.     public function setCategory(?Category $category): self
  131.     {
  132.         $this->category $category;
  133.         return $this;
  134.     }
  135.     public function getSubCategory(): ?SubCategory
  136.     {
  137.         return $this->subCategory;
  138.     }
  139.     public function setSubCategory(?SubCategory $subCategory): self
  140.     {
  141.         $this->subCategory $subCategory;
  142.         return $this;
  143.     }
  144.     public function getCreationDate(): ?\DateTimeInterface
  145.     {
  146.         return $this->creation_date;
  147.     }
  148.     public function setCreationDate(\DateTimeInterface $creation_date): self
  149.     {
  150.         $this->creation_date $creation_date;
  151.         return $this;
  152.     }
  153.     /**
  154.      * @return Collection<int, Stock>
  155.      */
  156.     public function getStocks(): Collection
  157.     {
  158.         return $this->stocks;
  159.     }
  160.     public function addStock(Stock $stock): self
  161.     {
  162.         if (!$this->stocks->contains($stock)) {
  163.             $this->stocks[] = $stock;
  164.             $stock->setProduct($this);
  165.         }
  166.         return $this;
  167.     }
  168.     public function removeStock(Stock $stock): self
  169.     {
  170.         if ($this->stocks->removeElement($stock)) {
  171.             // set the owning side to null (unless already changed)
  172.             if ($stock->getProduct() === $this) {
  173.                 $stock->setProduct(null);
  174.             }
  175.         }
  176.         return $this;
  177.     }
  178.     /**
  179.      * @return Collection<int, SaleItems>
  180.      */
  181.     public function getSaleItems(): Collection
  182.     {
  183.         return $this->saleItems;
  184.     }
  185.     public function addSaleItem(SaleItems $saleItem): self
  186.     {
  187.         if (!$this->saleItems->contains($saleItem)) {
  188.             $this->saleItems[] = $saleItem;
  189.             $saleItem->setProduct($this);
  190.         }
  191.         return $this;
  192.     }
  193.     public function removeSaleItem(SaleItems $saleItem): self
  194.     {
  195.         if ($this->saleItems->removeElement($saleItem)) {
  196.             // set the owning side to null (unless already changed)
  197.             if ($saleItem->getProduct() === $this) {
  198.                 $saleItem->setProduct(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203.     /**
  204.      * @return Collection<int, DiscountProducts>
  205.      */
  206.     public function getDiscountedProducts(): Collection
  207.     {
  208.         return $this->discountedProducts;
  209.     }
  210.     public function addDiscountedProduct(DiscountProducts $discountedProduct): self
  211.     {
  212.         if (!$this->discountedProducts->contains($discountedProduct)) {
  213.             $this->discountedProducts[] = $discountedProduct;
  214.             $discountedProduct->setProduct($this);
  215.         }
  216.         return $this;
  217.     }
  218.     public function removeDiscountedProduct(DiscountProducts $discountedProduct): self
  219.     {
  220.         if ($this->discountedProducts->removeElement($discountedProduct)) {
  221.             // set the owning side to null (unless already changed)
  222.             if ($discountedProduct->getProduct() === $this) {
  223.                 $discountedProduct->setProduct(null);
  224.             }
  225.         }
  226.         return $this;
  227.     }
  228.     /**
  229.      * @return mixed
  230.      */
  231.     public function getShortcut()
  232.     {
  233.         return $this->shortcut;
  234.     }
  235.     /**
  236.      * @param mixed $shortcut
  237.      */
  238.     public function setShortcut($shortcut): void
  239.     {
  240.         $this->shortcut $shortcut;
  241.     }
  242.     /**
  243.      * @return Collection<int, Notifications>
  244.      */
  245.     public function getNotifications(): Collection
  246.     {
  247.         return $this->notifications;
  248.     }
  249.     public function addNotification(Notifications $notification): self
  250.     {
  251.         if (!$this->notifications->contains($notification)) {
  252.             $this->notifications[] = $notification;
  253.             $notification->setProductId($this);
  254.         }
  255.         return $this;
  256.     }
  257.     public function removeNotification(Notifications $notification): self
  258.     {
  259.         if ($this->notifications->removeElement($notification)) {
  260.             // set the owning side to null (unless already changed)
  261.             if ($notification->getProductId() === $this) {
  262.                 $notification->setProductId(null);
  263.             }
  264.         }
  265.         return $this;
  266.     }
  267.     /**
  268.      * @return mixed
  269.      */
  270.     public function getTarget()
  271.     {
  272.         return $this->target;
  273.     }
  274.     /**
  275.      * @param mixed $target
  276.      */
  277.     public function setTarget($target): void
  278.     {
  279.         $this->target $target;
  280.     }
  281.     /**
  282.      * @return mixed
  283.      */
  284.     public function getisSynch()
  285.     {
  286.         return $this->isSynch;
  287.     }
  288.     /**
  289.      * @param mixed $isSynch
  290.      */
  291.     public function setisSynch($isSynch): void
  292.     {
  293.         $this->isSynch $isSynch;
  294.     }
  295.     /**
  296.      * @return mixed
  297.      */
  298.     public function getDeleted()
  299.     {
  300.         return $this->deleted;
  301.     }
  302.     /**
  303.      * @param mixed $deleted
  304.      */
  305.     public function setDeleted($deleted): void
  306.     {
  307.         $this->deleted $deleted;
  308.     }
  309. }