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=true, onDelete="SET NULL")
  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.      * Preiseinheit / PE — quantity the buying_price refers to (e.g. 1000 means price per 1000 KG).
  60.      * NULL means price is per single unit (default).
  61.      *
  62.      * @ORM\Column(type="float", nullable=true)
  63.      * @Groups({
  64.      *      "supplier_product@core"
  65.      *   })
  66.      */
  67.     private $price_unit;
  68.     /**
  69.      * @ORM\Column(type="float", nullable=true)
  70.      * @Groups({
  71.      *       "supplier_product@core"
  72.      *   })
  73.      */
  74.     private $sales_margin;
  75.     /**
  76.      * @ORM\Column(type="float", nullable=true)
  77.      * @Groups({
  78.      *       "supplier_product@core"
  79.      *   })
  80.      */
  81.     private $sales_price;
  82.     /**
  83.      * @ORM\Column(type="string", length=64, nullable=true)
  84.      * @Groups({
  85.      *        "supplier:product:core", "supplier_product@core"
  86.      *    })
  87.      */
  88.     private $article_nr;
  89.     /**
  90.      * @ORM\Column(type="string", length=255, nullable=true)
  91.      * @Groups({
  92.      *     "supplier_product@core"
  93.      * })
  94.      */
  95.     private $product_label;
  96.     /**
  97.      * @ORM\Column(type="string", length=255, nullable=true)
  98.      * @Groups({
  99.      *     "supplier_product@core"
  100.      * })
  101.      */
  102.     private $product_description;
  103.     /**
  104.      * @ORM\Column(type="float", nullable=true)
  105.      * @Groups({
  106.      *     "supplier_product@core"
  107.      * })
  108.      */
  109.     private $quantity;
  110.     /**
  111.      * @ORM\ManyToOne(targetEntity=Unit::class)
  112.      * @Groups({
  113.      *     "supplier_product@unit_type"
  114.      * })
  115.      */
  116.     private $unit_type;
  117.     /**
  118.      * @ORM\OneToMany(targetEntity=SupplierProductFrameworkContract::class, mappedBy="supplier_product")
  119.      * @Groups({
  120.      *     "supplier_product@framework_contracts"
  121.      * })
  122.      */
  123.     private $framework_contracts;
  124.     /**
  125.      * @ORM\ManyToOne(targetEntity=ProductCatalog::class, inversedBy="supplier_products")
  126.      * @ORM\JoinColumn(nullable=true)
  127.      * @Groups({
  128.      *      "supplier_product@product_catalog"
  129.      *  })
  130.      */
  131.     private $product_catalog;
  132.     /**
  133.      * @ORM\OneToMany(targetEntity=ProjectOrderExpensePositions::class, mappedBy="supplier_product")
  134.      */
  135.     private $project_order_expense_positions;
  136.     /**
  137.      * @ORM\ManyToMany(targetEntity=Norm::class, inversedBy="supplier_products")
  138.      * @ORM\JoinTable(name="supplier_product_norms")
  139.      * @Groups({"supplier_product@norms"})
  140.      */
  141.     private $norms;
  142.     /**
  143.      * @ORM\Column(type="string", length=255, nullable=true)
  144.      * @Groups({
  145.      *      "supplier_product@core"
  146.      *  })
  147.      */
  148.     private $material;
  149.     public function __construct()
  150.     {
  151.         $this->stocks = new ArrayCollection();
  152.         $this->framework_contracts = new ArrayCollection();
  153.         $this->project_order_expense_positions = new ArrayCollection();
  154.         $this->norms = new ArrayCollection();
  155.     }
  156.     public function getId(): ?int
  157.     {
  158.         return $this->id;
  159.     }
  160.     public function getSupplier(): ?Suppliers
  161.     {
  162.         return $this->supplier;
  163.     }
  164.     public function setSupplier(?Suppliers $supplier): self
  165.     {
  166.         $this->supplier $supplier;
  167.         return $this;
  168.     }
  169.     public function getStockItem(): ?StockItems
  170.     {
  171.         return $this->stock_item;
  172.     }
  173.     public function setStockItem(?StockItems $stock_item): self
  174.     {
  175.         $this->stock_item $stock_item;
  176.         return $this;
  177.     }
  178.     public function getEan(): ?string
  179.     {
  180.         return $this->ean;
  181.     }
  182.     public function setEan(?string $ean): self
  183.     {
  184.         $this->ean $ean;
  185.         return $this;
  186.     }
  187.     /**
  188.      * @return Collection<int, Stocks>
  189.      */
  190.     public function getStocks(): Collection
  191.     {
  192.         return $this->stocks;
  193.     }
  194.     public function addStock(Stocks $stock): self
  195.     {
  196.         if (!$this->stocks->contains($stock)) {
  197.             $this->stocks[] = $stock;
  198.             $stock->setSuppliedProduct($this);
  199.         }
  200.         return $this;
  201.     }
  202.     public function removeStock(Stocks $stock): self
  203.     {
  204.         if ($this->stocks->removeElement($stock)) {
  205.             // set the owning side to null (unless already changed)
  206.             if ($stock->getSuppliedProduct() === $this) {
  207.                 $stock->setSuppliedProduct(null);
  208.             }
  209.         }
  210.         return $this;
  211.     }
  212.     public function getBuyingPrice(): ?float
  213.     {
  214.         return $this->buying_price;
  215.     }
  216.     public function setBuyingPrice(?float $buying_price): self
  217.     {
  218.         $this->buying_price $buying_price;
  219.         return $this;
  220.     }
  221.     public function getPriceUnit(): ?float
  222.     {
  223.         return $this->price_unit;
  224.     }
  225.     public function setPriceUnit(?float $price_unit): self
  226.     {
  227.         $this->price_unit $price_unit;
  228.         return $this;
  229.     }
  230.     public function getSalesMargin(): ?float
  231.     {
  232.         return $this->sales_margin;
  233.     }
  234.     public function setSalesMargin(?float $sales_margin): self
  235.     {
  236.         $this->sales_margin $sales_margin;
  237.         return $this;
  238.     }
  239.     public function getSalesPrice(): ?float
  240.     {
  241.         return $this->sales_price;
  242.     }
  243.     public function setSalesPrice(?float $sales_price): self
  244.     {
  245.         $this->sales_price $sales_price;
  246.         return $this;
  247.     }
  248.     public function getArticleNr(): ?string
  249.     {
  250.         return $this->article_nr;
  251.     }
  252.     public function setArticleNr(?string $article_nr): self
  253.     {
  254.         $this->article_nr $article_nr;
  255.         return $this;
  256.     }
  257.     public function getProductLabel(): ?string
  258.     {
  259.         return $this->product_label;
  260.     }
  261.     public function setProductLabel(?string $product_label): self
  262.     {
  263.         $this->product_label $product_label;
  264.         return $this;
  265.     }
  266.     public function getProductDescription(): ?string
  267.     {
  268.         return $this->product_description;
  269.     }
  270.     public function setProductDescription(?string $product_description): self
  271.     {
  272.         $this->product_description $product_description;
  273.         return $this;
  274.     }
  275.     public function getQuantity(): ?float
  276.     {
  277.         return $this->quantity;
  278.     }
  279.     public function setQuantity(?float $quantity): self
  280.     {
  281.         $this->quantity $quantity;
  282.         return $this;
  283.     }
  284.     public function getUnitType(): ?Unit
  285.     {
  286.         return $this->unit_type;
  287.     }
  288.     public function setUnitType(?Unit $unit_type): self
  289.     {
  290.         $this->unit_type $unit_type;
  291.         return $this;
  292.     }
  293.     /**
  294.      * @return Collection<int, SupplierProductFrameworkContract>
  295.      */
  296.     public function getFrameworkContracts(): Collection
  297.     {
  298.         return $this->framework_contracts;
  299.     }
  300.     public function addFrameworkContract(SupplierProductFrameworkContract $frameworkContract): self
  301.     {
  302.         if (!$this->framework_contracts->contains($frameworkContract)) {
  303.             $this->framework_contracts[] = $frameworkContract;
  304.             $frameworkContract->setSupplierProduct($this);
  305.         }
  306.         return $this;
  307.     }
  308.     public function removeFrameworkContract(SupplierProductFrameworkContract $frameworkContract): self
  309.     {
  310.         if ($this->framework_contracts->removeElement($frameworkContract)) {
  311.             if ($frameworkContract->getSupplierProduct() === $this) {
  312.                 $frameworkContract->setSupplierProduct(null);
  313.             }
  314.         }
  315.         return $this;
  316.     }
  317.     public function getProductCatalog(): ?ProductCatalog
  318.     {
  319.         return $this->product_catalog;
  320.     }
  321.     public function setProductCatalog(?ProductCatalog $productCatalog): self
  322.     {
  323.         $this->product_catalog $productCatalog;
  324.         return $this;
  325.     }
  326.     /**
  327.      * @return Collection<int, ProjectOrderExpensePositions>
  328.      */
  329.     public function getProjectOrderExpensePositions(): Collection
  330.     {
  331.         return $this->project_order_expense_positions;
  332.     }
  333.     public function addProjectOrderExpensePosition(ProjectOrderExpensePositions $projectOrderExpensePosition): self
  334.     {
  335.         if (!$this->project_order_expense_positions->contains($projectOrderExpensePosition)) {
  336.             $this->project_order_expense_positions[] = $projectOrderExpensePosition;
  337.             $projectOrderExpensePosition->setSupplierProduct($this);
  338.         }
  339.         return $this;
  340.     }
  341.     public function removeProjectOrderExpensePosition(ProjectOrderExpensePositions $projectOrderExpensePosition): self
  342.     {
  343.         if ($this->project_order_expense_positions->removeElement($projectOrderExpensePosition)) {
  344.             // set the owning side to null (unless already changed)
  345.             if ($projectOrderExpensePosition->getSupplierProduct() === $this) {
  346.                 $projectOrderExpensePosition->setSupplierProduct(null);
  347.             }
  348.         }
  349.         return $this;
  350.     }
  351.     /**
  352.      * @return Collection<int, Norm>
  353.      */
  354.     public function getNorms(): Collection
  355.     {
  356.         return $this->norms;
  357.     }
  358.     public function addNorm(Norm $norm): self
  359.     {
  360.         if (!$this->norms->contains($norm)) {
  361.             $this->norms[] = $norm;
  362.         }
  363.         return $this;
  364.     }
  365.     public function removeNorm(Norm $norm): self
  366.     {
  367.         $this->norms->removeElement($norm);
  368.         return $this;
  369.     }
  370.     public function getMaterial(): ?string
  371.     {
  372.         return $this->material;
  373.     }
  374.     public function setMaterial(?string $material): self
  375.     {
  376.         $this->material $material;
  377.         return $this;
  378.     }
  379. }