src/Entity/Status.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StatusRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=StatusRepository::class)
  9.  */
  10. class Status
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=128)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="integer", nullable=true)
  24.      */
  25.     private $b2lId;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=Order::class, mappedBy="status")
  28.      */
  29.     private $orders;
  30.     /**
  31.      * @ORM\Column(type="string", length=32, nullable=true)
  32.      */
  33.     private $color;
  34.     /**
  35.      * @ORM\Column(type="string", length=32, nullable=true)
  36.      */
  37.     private $type;
  38.     /**
  39.      * @ORM\ManyToMany(targetEntity=Shop::class, mappedBy="statuses")
  40.      */
  41.     private $shops;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity=Sav::class, mappedBy="status")
  44.      */
  45.     private $savs;
  46.     public function __construct()
  47.     {
  48.         $this->orders = new ArrayCollection();
  49.         $this->shops = new ArrayCollection();
  50.         $this->savs = new ArrayCollection();
  51.     }
  52.     public function __toString() {
  53.         return $this->getName();
  54.     }
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getName(): ?string
  60.     {
  61.         return $this->name;
  62.     }
  63.     public function setName(string $name): self
  64.     {
  65.         $this->name $name;
  66.         return $this;
  67.     }
  68.     public function getB2lId(): ?int
  69.     {
  70.         return $this->b2lId;
  71.     }
  72.     public function setB2lId(?int $b2lId): self
  73.     {
  74.         $this->b2lId $b2lId;
  75.         return $this;
  76.     }
  77.     /**
  78.      * @return Collection<int, Order>
  79.      */
  80.     public function getOrders(): Collection
  81.     {
  82.         return $this->orders;
  83.     }
  84.     public function addOrder(Order $order): self
  85.     {
  86.         if (!$this->orders->contains($order)) {
  87.             $this->orders[] = $order;
  88.             $order->setStatus($this);
  89.         }
  90.         return $this;
  91.     }
  92.     public function removeOrder(Order $order): self
  93.     {
  94.         if ($this->orders->removeElement($order)) {
  95.             // set the owning side to null (unless already changed)
  96.             if ($order->getStatus() === $this) {
  97.                 $order->setStatus(null);
  98.             }
  99.         }
  100.         return $this;
  101.     }
  102.     public function getColor(): ?string
  103.     {
  104.         return $this->color;
  105.     }
  106.     public function setColor(?string $color): self
  107.     {
  108.         $this->color $color;
  109.         return $this;
  110.     }
  111.     /**
  112.      * @return Collection<int, Shop>
  113.      */
  114.     public function getShops(): Collection
  115.     {
  116.         return $this->shops;
  117.     }
  118.     public function addShop(Shop $shop): static
  119.     {
  120.         if (!$this->shops->contains($shop)) {
  121.             $this->shops->add($shop);
  122.             $shop->addStatus($this);
  123.         }
  124.         return $this;
  125.     }
  126.     public function removeShop(Shop $shop): static
  127.     {
  128.         if ($this->shops->removeElement($shop)) {
  129.             $shop->removeStatus($this);
  130.         }
  131.         return $this;
  132.     }
  133.     public function getType(): ?string
  134.     {
  135.         return $this->type;
  136.     }
  137.     public function setType(?string $type): static
  138.     {
  139.         $this->type $type;
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return Collection<int, Sav>
  144.      */
  145.     public function getSavs(): Collection
  146.     {
  147.         return $this->savs;
  148.     }
  149.     public function addSav(Sav $sav): static
  150.     {
  151.         if (!$this->savs->contains($sav)) {
  152.             $this->savs->add($sav);
  153.             $sav->setStatus($this);
  154.         }
  155.         return $this;
  156.     }
  157.     public function removeSav(Sav $sav): static
  158.     {
  159.         if ($this->savs->removeElement($sav)) {
  160.             // set the owning side to null (unless already changed)
  161.             if ($sav->getStatus() === $this) {
  162.                 $sav->setStatus(null);
  163.             }
  164.         }
  165.         return $this;
  166.     }
  167. }