src/Entity/Unit.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UnitRepository;
  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.  * @deprecated THIS IS LAST PROCESS (Hersey Tamamlandiktan sonra)
  10.  * TODO Replace this with Units!!!
  11.  * @ORM\Entity(repositoryClass=UnitRepository::class)
  12.  */
  13. class Unit
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      * @Groups({
  20.      *      "unit.core",
  21.      *      "unit@core",
  22.      *      "unit_type@core",
  23.      *      "unit_type@base"
  24.      *  })
  25.      */
  26.     private $id;
  27.     /**
  28.      * @ORM\Column(type="string", length=64)
  29.      * @Groups({
  30.      *      "unit.core",
  31.      *      "unit@core",
  32.      *      "unit_type@core",
  33.      *      "unit_type@base"
  34.      *  })
  35.      */
  36.     private $code;
  37.     /**
  38.      * @ORM\Column(type="string", length=64)
  39.      * @Groups({
  40.      *      "unit.core",
  41.      *      "unit@core",
  42.      *      "unit_type@core",
  43.      *      "unit_type@base"
  44.      *  })
  45.      */
  46.     private $label;
  47.     /**
  48.      * @ORM\Column(type="datetime_immutable")
  49.      * @Groups({
  50.      *      "unit.core",
  51.      *      "unit@core",
  52.      *      "unit_type@core",
  53.      *      "unit_type@base"
  54.      *  })
  55.      */
  56.     private $created_at;
  57.     /**
  58.      * @ORM\OneToMany(targetEntity=Inventory::class, mappedBy="unit")
  59.      * @Groups({
  60.      *      "unit.core",
  61.      *      "unit@core",
  62.      *      "unit_type@inventories"
  63.      *  })
  64.      */
  65.     private $inventories;
  66.     /**
  67.      * @ORM\OneToMany(targetEntity=StockItems::class, mappedBy="unit", orphanRemoval=true)
  68.      * @Groups({
  69.      *     "unit.core",
  70.      *     "unit@core",
  71.      *     "unit_type@stock_items"
  72.      * })
  73.      */
  74.     private $stockItems;
  75.     /**
  76.      * @ORM\OneToMany(targetEntity=ProjectOrderBillings::class, mappedBy="unit_type")
  77.      * @Groups({
  78.      *      "unit.core",
  79.      *      "unit@core",
  80.      *      "unit_type@order_billings"
  81.      *  })
  82.      */
  83.     private $project_order_billings;
  84.     public function __construct()
  85.     {
  86.         $this->inventories = new ArrayCollection();
  87.         $this->stockItems = new ArrayCollection();
  88.         $this->project_order_billings = new ArrayCollection();
  89.     }
  90.     public function getId(): ?int
  91.     {
  92.         return $this->id;
  93.     }
  94.     public function getCode(): ?string
  95.     {
  96.         return $this->code;
  97.     }
  98.     public function setCode(string $code): self
  99.     {
  100.         $this->code $code;
  101.         return $this;
  102.     }
  103.     public function getLabel(): ?string
  104.     {
  105.         return $this->label;
  106.     }
  107.     public function setLabel(string $label): self
  108.     {
  109.         $this->label $label;
  110.         return $this;
  111.     }
  112.     public function getCreatedAt(): ?\DateTimeImmutable
  113.     {
  114.         return $this->created_at;
  115.     }
  116.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  117.     {
  118.         $this->created_at $created_at;
  119.         return $this;
  120.     }
  121.     /**
  122.      * @return Collection<int, Inventory>
  123.      */
  124.     public function getInventories(): Collection
  125.     {
  126.         return $this->inventories;
  127.     }
  128.     public function addInventory(Inventory $inventory): self
  129.     {
  130.         if (!$this->inventories->contains($inventory)) {
  131.             $this->inventories[] = $inventory;
  132.             $inventory->setUnit($this);
  133.         }
  134.         return $this;
  135.     }
  136.     public function removeInventory(Inventory $inventory): self
  137.     {
  138.         if ($this->inventories->removeElement($inventory)) {
  139.             // set the owning side to null (unless already changed)
  140.             if ($inventory->getUnit() === $this) {
  141.                 $inventory->setUnit(null);
  142.             }
  143.         }
  144.         return $this;
  145.     }
  146.     /**
  147.      * @return Collection<int, StockItems>
  148.      */
  149.     public function getStockItems(): Collection
  150.     {
  151.         return $this->stockItems;
  152.     }
  153.     public function addStockItem(StockItems $stockItem): self
  154.     {
  155.         if (!$this->stockItems->contains($stockItem)) {
  156.             $this->stockItems[] = $stockItem;
  157.             $stockItem->setUnit($this);
  158.         }
  159.         return $this;
  160.     }
  161.     public function removeStockItem(StockItems $stockItem): self
  162.     {
  163.         if ($this->stockItems->removeElement($stockItem)) {
  164.             // set the owning side to null (unless already changed)
  165.             if ($stockItem->getUnit() === $this) {
  166.                 $stockItem->setUnit(null);
  167.             }
  168.         }
  169.         return $this;
  170.     }
  171.     /**
  172.      * @return Collection<int, ProjectOrderBillings>
  173.      */
  174.     public function getProjectOrderBillings(): Collection
  175.     {
  176.         return $this->project_order_billings;
  177.     }
  178.     public function addProjectOrderBilling(ProjectOrderBillings $projectOrderBilling): self
  179.     {
  180.         if (!$this->project_order_billings->contains($projectOrderBilling)) {
  181.             $this->project_order_billings[] = $projectOrderBilling;
  182.             $projectOrderBilling->setUnitType($this);
  183.         }
  184.         return $this;
  185.     }
  186.     public function removeProjectOrderBilling(ProjectOrderBillings $projectOrderBilling): self
  187.     {
  188.         if ($this->project_order_billings->removeElement($projectOrderBilling)) {
  189.             // set the owning side to null (unless already changed)
  190.             if ($projectOrderBilling->getUnitType() === $this) {
  191.                 $projectOrderBilling->setUnitType(null);
  192.             }
  193.         }
  194.         return $this;
  195.     }
  196. }