src/Entity/SupplierProducts.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SupplierProductsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Serializer\Annotation\MaxDepth;
  9. /**
  10.  * @ORM\Entity(repositoryClass=SupplierProductsRepository::class)
  11.  */
  12. class SupplierProducts
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      * @Groups({
  19.      *     "supplier:product:core", "supplier_product:core", "supplier_product@core"
  20.      * })
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity=Suppliers::class, inversedBy="supplierProducts")
  25.      * @Groups({
  26.      *      "supplier:product:supplier", "supplier_product:supplier", "supplier_product@supplier"
  27.      *  })
  28.      */
  29.     private $supplier;
  30.     /**
  31.      * @MaxDepth(1)
  32.      * @ORM\ManyToOne(targetEntity=StockItems::class, inversedBy="supplierProducts")
  33.      * @Groups({
  34.      *          "supplier:product:stock:items",
  35.      *          "supplier_product:stock_item"
  36.      *   })
  37.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  38.      */
  39.     private $stock_item;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=true)
  42.      * @Groups({
  43.      *      "supplier:product:core", "supplier_product:core", "supplier_product@core"
  44.      *  })
  45.      */
  46.     private $ean;
  47.     /**
  48.      * @ORM\OneToMany(targetEntity=Stocks::class, mappedBy="supplied_product")
  49.      */
  50.     private $stocks;
  51.     /**
  52.      * @ORM\Column(type="float", nullable=true)
  53.      * @Groups({
  54.      *      "supplier_product@core"
  55.      *   })
  56.      */
  57.     private $buying_price;
  58.     /**
  59.      * @ORM\Column(type="float", nullable=true)
  60.      * @Groups({
  61.      *       "supplier_product@core"
  62.      *   })
  63.      */
  64.     private $sales_margin;
  65.     /**
  66.      * @ORM\Column(type="float", nullable=true)
  67.      * @Groups({
  68.      *       "supplier_product@core"
  69.      *   })
  70.      */
  71.     private $sales_price;
  72.     /**
  73.      * @ORM\Column(type="string", length=64, nullable=true)
  74.      * @Groups({
  75.      *        "supplier:product:core", "supplier_product@core"
  76.      *    })
  77.      */
  78.     private $article_nr;
  79.     public function __construct()
  80.     {
  81.         $this->stocks = new ArrayCollection();
  82.     }
  83.     public function getId(): ?int
  84.     {
  85.         return $this->id;
  86.     }
  87.     public function getSupplier(): ?Suppliers
  88.     {
  89.         return $this->supplier;
  90.     }
  91.     public function setSupplier(?Suppliers $supplier): self
  92.     {
  93.         $this->supplier $supplier;
  94.         return $this;
  95.     }
  96.     public function getStockItem(): ?StockItems
  97.     {
  98.         return $this->stock_item;
  99.     }
  100.     public function setStockItem(?StockItems $stock_item): self
  101.     {
  102.         $this->stock_item $stock_item;
  103.         return $this;
  104.     }
  105.     public function getEan(): ?string
  106.     {
  107.         return $this->ean;
  108.     }
  109.     public function setEan(?string $ean): self
  110.     {
  111.         $this->ean $ean;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return Collection<int, Stocks>
  116.      */
  117.     public function getStocks(): Collection
  118.     {
  119.         return $this->stocks;
  120.     }
  121.     public function addStock(Stocks $stock): self
  122.     {
  123.         if (!$this->stocks->contains($stock)) {
  124.             $this->stocks[] = $stock;
  125.             $stock->setSuppliedProduct($this);
  126.         }
  127.         return $this;
  128.     }
  129.     public function removeStock(Stocks $stock): self
  130.     {
  131.         if ($this->stocks->removeElement($stock)) {
  132.             // set the owning side to null (unless already changed)
  133.             if ($stock->getSuppliedProduct() === $this) {
  134.                 $stock->setSuppliedProduct(null);
  135.             }
  136.         }
  137.         return $this;
  138.     }
  139.     public function getBuyingPrice(): ?float
  140.     {
  141.         return $this->buying_price;
  142.     }
  143.     public function setBuyingPrice(?float $buying_price): self
  144.     {
  145.         $this->buying_price $buying_price;
  146.         return $this;
  147.     }
  148.     public function getSalesMargin(): ?float
  149.     {
  150.         return $this->sales_margin;
  151.     }
  152.     public function setSalesMargin(?float $sales_margin): self
  153.     {
  154.         $this->sales_margin $sales_margin;
  155.         return $this;
  156.     }
  157.     public function getSalesPrice(): ?float
  158.     {
  159.         return $this->sales_price;
  160.     }
  161.     public function setSalesPrice(?float $sales_price): self
  162.     {
  163.         $this->sales_price $sales_price;
  164.         return $this;
  165.     }
  166.     public function getArticleNr(): ?string
  167.     {
  168.         return $this->article_nr;
  169.     }
  170.     public function setArticleNr(?string $article_nr): self
  171.     {
  172.         $this->article_nr $article_nr;
  173.         return $this;
  174.     }
  175. }