src/Entity/OrderStatus.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OrderStatusRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=OrderStatusRepository::class)
  9.  */
  10. class OrderStatus
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity=Order::class, mappedBy="stat")
  24.      */
  25.     private $orders;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $badge;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $name_en;
  34.     public function __construct()
  35.     {
  36.         $this->orders = new ArrayCollection();
  37.     }
  38.     public function __toString()
  39.     {
  40.         return $this->getName();
  41.     }
  42.     
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getName(): ?string
  48.     {
  49.         return $this->name;
  50.     }
  51.     public function setName(string $name): self
  52.     {
  53.         $this->name $name;
  54.         return $this;
  55.     }
  56.     /**
  57.      * @return Collection<int, Order>
  58.      */
  59.     public function getOrders(): Collection
  60.     {
  61.         return $this->orders;
  62.     }
  63.     public function addOrder(Order $order): self
  64.     {
  65.         if (!$this->orders->contains($order)) {
  66.             $this->orders[] = $order;
  67.             $order->setStat($this);
  68.         }
  69.         return $this;
  70.     }
  71.     public function removeOrder(Order $order): self
  72.     {
  73.         if ($this->orders->removeElement($order)) {
  74.             // set the owning side to null (unless already changed)
  75.             if ($order->getStat() === $this) {
  76.                 $order->setStat(null);
  77.             }
  78.         }
  79.         return $this;
  80.     }
  81.     public function getBadge(): ?string
  82.     {
  83.         return $this->badge;
  84.     }
  85.     public function setBadge(?string $badge): self
  86.     {
  87.         $this->badge $badge;
  88.         return $this;
  89.     }
  90.     public function getNameEn(): ?string
  91.     {
  92.         return $this->name_en;
  93.     }
  94.     public function setNameEn(?string $name_en): self
  95.     {
  96.         $this->name_en $name_en;
  97.         return $this;
  98.     }
  99. }