src/Entity/Shop.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ShopRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ShopRepository::class)
  9.  */
  10. class Shop
  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 $label;
  22.     /**
  23.      * @ORM\Column(type="string", length=10, nullable=true)
  24.      */
  25.     private $code;
  26.     /**
  27.      * @ORM\Column(type="datetime")
  28.      */
  29.     private $creation_date;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=Stock::class, mappedBy="shop")
  32.      */
  33.     private $stocks;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=Discount::class, mappedBy="shop")
  36.      */
  37.     private $discounts;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=UserShop::class, mappedBy="shop")
  40.      */
  41.     private $users;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity=Sales::class, mappedBy="shop")
  44.      */
  45.     private $sales;
  46.     public function __construct()
  47.     {
  48.         $this->stocks = new ArrayCollection();
  49.         $this->discounts = new ArrayCollection();
  50.         $this->users = new ArrayCollection();
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getLabel(): ?string
  57.     {
  58.         return $this->label;
  59.     }
  60.     public function setLabel(string $label): self
  61.     {
  62.         $this->label $label;
  63.         return $this;
  64.     }
  65.     public function getCode(): ?string
  66.     {
  67.         return $this->code;
  68.     }
  69.     public function setCode(?string $code): self
  70.     {
  71.         $this->code $code;
  72.         return $this;
  73.     }
  74.     public function getCreationDate(): ?\DateTimeInterface
  75.     {
  76.         return $this->creation_date;
  77.     }
  78.     public function setCreationDate(\DateTimeInterface $creation_date): self
  79.     {
  80.         $this->creation_date $creation_date;
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection<int, Stock>
  85.      */
  86.     public function getStocks(): Collection
  87.     {
  88.         return $this->stocks;
  89.     }
  90.     public function addStock(Stock $stock): self
  91.     {
  92.         if (!$this->stocks->contains($stock)) {
  93.             $this->stocks[] = $stock;
  94.             $stock->setShop($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeStock(Stock $stock): self
  99.     {
  100.         if ($this->stocks->removeElement($stock)) {
  101.             // set the owning side to null (unless already changed)
  102.             if ($stock->getShop() === $this) {
  103.                 $stock->setShop(null);
  104.             }
  105.         }
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return Collection<int, Discount>
  110.      */
  111.     public function getDiscounts(): Collection
  112.     {
  113.         return $this->discounts;
  114.     }
  115.     public function addDiscount(Discount $discount): self
  116.     {
  117.         if (!$this->discounts->contains($discount)) {
  118.             $this->discounts[] = $discount;
  119.             $discount->setShop($this);
  120.         }
  121.         return $this;
  122.     }
  123.     public function removeDiscount(Discount $discount): self
  124.     {
  125.         if ($this->discounts->removeElement($discount)) {
  126.             // set the owning side to null (unless already changed)
  127.             if ($discount->getShop() === $this) {
  128.                 $discount->setShop(null);
  129.             }
  130.         }
  131.         return $this;
  132.     }
  133.     /**
  134.      * @return Collection<int, UserShop>
  135.      */
  136.     public function getUsers(): Collection
  137.     {
  138.         return $this->users;
  139.     }
  140.     public function addUser(UserShop $user): self
  141.     {
  142.         if (!$this->users->contains($user)) {
  143.             $this->users[] = $user;
  144.             $user->setShop($this);
  145.         }
  146.         return $this;
  147.     }
  148.     public function removeUser(UserShop $user): self
  149.     {
  150.         if ($this->users->removeElement($user)) {
  151.             // set the owning side to null (unless already changed)
  152.             if ($user->getShop() === $this) {
  153.                 $user->setShop(null);
  154.             }
  155.         }
  156.         return $this;
  157.     }
  158.     /**
  159.      * @return mixed
  160.      */
  161.     public function getSales()
  162.     {
  163.         return $this->sales;
  164.     }
  165.     /**
  166.      * @param mixed $sales
  167.      */
  168.     public function setSales($sales): void
  169.     {
  170.         $this->sales $sales;
  171.     }
  172. }