<?php
namespace App\Entity;
use App\Repository\SupplierOrdersRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=SupplierOrdersRepository::class)
*/
class SupplierOrders
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "supplier.order.for.inventory"
* })
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Suppliers::class, inversedBy="supplierOrders")
* @Groups({
* "supplier.order.base"
* })
*/
private $supplier;
/**
* @ORM\ManyToOne(targetEntity=Material::class, inversedBy="supplierOrders")
*/
private $material;
/**
* @ORM\Column(type="integer", nullable=true)
* @Groups({
* "supplier.order.for.inventory"
* })
*/
private $unit;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $order_at;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="supplierOrders")
*/
private $order_by;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $delivered_at;
/**
* @ORM\OneToMany(targetEntity=Inventory::class, mappedBy="supplier_order")
*/
private $inventories;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Groups({
* "supplier.order.for.inventory"
* })
*/
private $supplier_order_nr;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $content;
public function __construct()
{
$this->inventories = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getSupplier(): ?Suppliers
{
return $this->supplier;
}
public function setSupplier(?Suppliers $supplier): self
{
$this->supplier = $supplier;
return $this;
}
public function getMaterial(): ?Material
{
return $this->material;
}
public function setMaterial(?Material $material): self
{
$this->material = $material;
return $this;
}
public function getUnit(): ?int
{
return $this->unit;
}
public function setUnit(?int $unit): self
{
$this->unit = $unit;
return $this;
}
public function getOrderAt(): ?\DateTimeImmutable
{
return $this->order_at;
}
public function setOrderAt(?\DateTimeImmutable $order_at): self
{
$this->order_at = $order_at;
return $this;
}
public function getOrderBy(): ?User
{
return $this->order_by;
}
public function setOrderBy(?User $order_by): self
{
$this->order_by = $order_by;
return $this;
}
public function getDeliveredAt(): ?\DateTimeImmutable
{
return $this->delivered_at;
}
public function setDeliveredAt(?\DateTimeImmutable $delivered_at): self
{
$this->delivered_at = $delivered_at;
return $this;
}
/**
* @return Collection<int, Inventory>
*/
public function getInventories(): Collection
{
return $this->inventories;
}
public function addInventory(Inventory $inventory): self
{
if (!$this->inventories->contains($inventory)) {
$this->inventories[] = $inventory;
$inventory->setSupplierOrder($this);
}
return $this;
}
public function removeInventory(Inventory $inventory): self
{
if ($this->inventories->removeElement($inventory)) {
// set the owning side to null (unless already changed)
if ($inventory->getSupplierOrder() === $this) {
$inventory->setSupplierOrder(null);
}
}
return $this;
}
public function getSupplierOrderNr(): ?string
{
return $this->supplier_order_nr;
}
public function setSupplierOrderNr(?string $supplier_order_nr): self
{
$this->supplier_order_nr = $supplier_order_nr;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
}