src/Entity/SupplierOrders.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SupplierOrdersRepository;
  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. /**
  9.  * @ORM\Entity(repositoryClass=SupplierOrdersRepository::class)
  10.  */
  11. class SupplierOrders
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      * @Groups({
  18.      *     "supplier.order.for.inventory"
  19.      * })
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Suppliers::class, inversedBy="supplierOrders")
  24.      * @Groups({
  25.      *        "supplier.order.base"
  26.      *    })
  27.      */
  28.     private $supplier;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity=Material::class, inversedBy="supplierOrders")
  31.      */
  32.     private $material;
  33.     /**
  34.      * @ORM\Column(type="integer", nullable=true)
  35.      * @Groups({
  36.      *      "supplier.order.for.inventory"
  37.      *  })
  38.      */
  39.     private $unit;
  40.     /**
  41.      * @ORM\Column(type="datetime_immutable", nullable=true)
  42.      */
  43.     private $order_at;
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="supplierOrders")
  46.      */
  47.     private $order_by;
  48.     /**
  49.      * @ORM\Column(type="datetime_immutable", nullable=true)
  50.      */
  51.     private $delivered_at;
  52.     /**
  53.      * @ORM\OneToMany(targetEntity=Inventory::class, mappedBy="supplier_order")
  54.      */
  55.     private $inventories;
  56.     /**
  57.      * @ORM\Column(type="string", length=64, nullable=true)
  58.      * @Groups({
  59.      *       "supplier.order.for.inventory"
  60.      *   })
  61.      */
  62.     private $supplier_order_nr;
  63.     /**
  64.      * @ORM\Column(type="text", nullable=true)
  65.      */
  66.     private $content;
  67.     public function __construct()
  68.     {
  69.         $this->inventories = new ArrayCollection();
  70.     }
  71.     public function getId(): ?int
  72.     {
  73.         return $this->id;
  74.     }
  75.     public function getSupplier(): ?Suppliers
  76.     {
  77.         return $this->supplier;
  78.     }
  79.     public function setSupplier(?Suppliers $supplier): self
  80.     {
  81.         $this->supplier $supplier;
  82.         return $this;
  83.     }
  84.     public function getMaterial(): ?Material
  85.     {
  86.         return $this->material;
  87.     }
  88.     public function setMaterial(?Material $material): self
  89.     {
  90.         $this->material $material;
  91.         return $this;
  92.     }
  93.     public function getUnit(): ?int
  94.     {
  95.         return $this->unit;
  96.     }
  97.     public function setUnit(?int $unit): self
  98.     {
  99.         $this->unit $unit;
  100.         return $this;
  101.     }
  102.     public function getOrderAt(): ?\DateTimeImmutable
  103.     {
  104.         return $this->order_at;
  105.     }
  106.     public function setOrderAt(?\DateTimeImmutable $order_at): self
  107.     {
  108.         $this->order_at $order_at;
  109.         return $this;
  110.     }
  111.     public function getOrderBy(): ?User
  112.     {
  113.         return $this->order_by;
  114.     }
  115.     public function setOrderBy(?User $order_by): self
  116.     {
  117.         $this->order_by $order_by;
  118.         return $this;
  119.     }
  120.     public function getDeliveredAt(): ?\DateTimeImmutable
  121.     {
  122.         return $this->delivered_at;
  123.     }
  124.     public function setDeliveredAt(?\DateTimeImmutable $delivered_at): self
  125.     {
  126.         $this->delivered_at $delivered_at;
  127.         return $this;
  128.     }
  129.     /**
  130.      * @return Collection<int, Inventory>
  131.      */
  132.     public function getInventories(): Collection
  133.     {
  134.         return $this->inventories;
  135.     }
  136.     public function addInventory(Inventory $inventory): self
  137.     {
  138.         if (!$this->inventories->contains($inventory)) {
  139.             $this->inventories[] = $inventory;
  140.             $inventory->setSupplierOrder($this);
  141.         }
  142.         return $this;
  143.     }
  144.     public function removeInventory(Inventory $inventory): self
  145.     {
  146.         if ($this->inventories->removeElement($inventory)) {
  147.             // set the owning side to null (unless already changed)
  148.             if ($inventory->getSupplierOrder() === $this) {
  149.                 $inventory->setSupplierOrder(null);
  150.             }
  151.         }
  152.         return $this;
  153.     }
  154.     public function getSupplierOrderNr(): ?string
  155.     {
  156.         return $this->supplier_order_nr;
  157.     }
  158.     public function setSupplierOrderNr(?string $supplier_order_nr): self
  159.     {
  160.         $this->supplier_order_nr $supplier_order_nr;
  161.         return $this;
  162.     }
  163.     public function getContent(): ?string
  164.     {
  165.         return $this->content;
  166.     }
  167.     public function setContent(?string $content): self
  168.     {
  169.         $this->content $content;
  170.         return $this;
  171.     }
  172. }