<?php
namespace App\Entity;
use App\Repository\StatusRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=StatusRepository::class)
*/
class Status
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=128)
*/
private $name;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $b2lId;
/**
* @ORM\OneToMany(targetEntity=Order::class, mappedBy="status")
*/
private $orders;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
private $color;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
private $type;
/**
* @ORM\ManyToMany(targetEntity=Shop::class, mappedBy="statuses")
*/
private $shops;
/**
* @ORM\OneToMany(targetEntity=Sav::class, mappedBy="status")
*/
private $savs;
public function __construct()
{
$this->orders = new ArrayCollection();
$this->shops = new ArrayCollection();
$this->savs = new ArrayCollection();
}
public function __toString() {
return $this->getName();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getB2lId(): ?int
{
return $this->b2lId;
}
public function setB2lId(?int $b2lId): self
{
$this->b2lId = $b2lId;
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setStatus($this);
}
return $this;
}
public function removeOrder(Order $order): self
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getStatus() === $this) {
$order->setStatus(null);
}
}
return $this;
}
public function getColor(): ?string
{
return $this->color;
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
/**
* @return Collection<int, Shop>
*/
public function getShops(): Collection
{
return $this->shops;
}
public function addShop(Shop $shop): static
{
if (!$this->shops->contains($shop)) {
$this->shops->add($shop);
$shop->addStatus($this);
}
return $this;
}
public function removeShop(Shop $shop): static
{
if ($this->shops->removeElement($shop)) {
$shop->removeStatus($this);
}
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): static
{
$this->type = $type;
return $this;
}
/**
* @return Collection<int, Sav>
*/
public function getSavs(): Collection
{
return $this->savs;
}
public function addSav(Sav $sav): static
{
if (!$this->savs->contains($sav)) {
$this->savs->add($sav);
$sav->setStatus($this);
}
return $this;
}
public function removeSav(Sav $sav): static
{
if ($this->savs->removeElement($sav)) {
// set the owning side to null (unless already changed)
if ($sav->getStatus() === $this) {
$sav->setStatus(null);
}
}
return $this;
}
}