<?php
namespace App\Entity;
use App\Repository\UnitRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @deprecated THIS IS LAST PROCESS (Hersey Tamamlandiktan sonra)
* TODO Replace this with Units!!!
* @ORM\Entity(repositoryClass=UnitRepository::class)
*/
class Unit
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "unit.core",
* "unit@core",
* "unit_type@core",
* "unit_type@base"
* })
*/
private $id;
/**
* @ORM\Column(type="string", length=64)
* @Groups({
* "unit.core",
* "unit@core",
* "unit_type@core",
* "unit_type@base"
* })
*/
private $code;
/**
* @ORM\Column(type="string", length=64)
* @Groups({
* "unit.core",
* "unit@core",
* "unit_type@core",
* "unit_type@base"
* })
*/
private $label;
/**
* @ORM\Column(type="datetime_immutable")
* @Groups({
* "unit.core",
* "unit@core",
* "unit_type@core",
* "unit_type@base"
* })
*/
private $created_at;
/**
* @ORM\OneToMany(targetEntity=Inventory::class, mappedBy="unit")
* @Groups({
* "unit.core",
* "unit@core",
* "unit_type@inventories"
* })
*/
private $inventories;
/**
* @ORM\OneToMany(targetEntity=StockItems::class, mappedBy="unit", orphanRemoval=true)
* @Groups({
* "unit.core",
* "unit@core",
* "unit_type@stock_items"
* })
*/
private $stockItems;
/**
* @ORM\OneToMany(targetEntity=ProjectOrderBillings::class, mappedBy="unit_type")
* @Groups({
* "unit.core",
* "unit@core",
* "unit_type@order_billings"
* })
*/
private $project_order_billings;
public function __construct()
{
$this->inventories = new ArrayCollection();
$this->stockItems = new ArrayCollection();
$this->project_order_billings = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_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->setUnit($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->getUnit() === $this) {
$inventory->setUnit(null);
}
}
return $this;
}
/**
* @return Collection<int, StockItems>
*/
public function getStockItems(): Collection
{
return $this->stockItems;
}
public function addStockItem(StockItems $stockItem): self
{
if (!$this->stockItems->contains($stockItem)) {
$this->stockItems[] = $stockItem;
$stockItem->setUnit($this);
}
return $this;
}
public function removeStockItem(StockItems $stockItem): self
{
if ($this->stockItems->removeElement($stockItem)) {
// set the owning side to null (unless already changed)
if ($stockItem->getUnit() === $this) {
$stockItem->setUnit(null);
}
}
return $this;
}
/**
* @return Collection<int, ProjectOrderBillings>
*/
public function getProjectOrderBillings(): Collection
{
return $this->project_order_billings;
}
public function addProjectOrderBilling(ProjectOrderBillings $projectOrderBilling): self
{
if (!$this->project_order_billings->contains($projectOrderBilling)) {
$this->project_order_billings[] = $projectOrderBilling;
$projectOrderBilling->setUnitType($this);
}
return $this;
}
public function removeProjectOrderBilling(ProjectOrderBillings $projectOrderBilling): self
{
if ($this->project_order_billings->removeElement($projectOrderBilling)) {
// set the owning side to null (unless already changed)
if ($projectOrderBilling->getUnitType() === $this) {
$projectOrderBilling->setUnitType(null);
}
}
return $this;
}
}