<?php
namespace App\Entity;
use App\Repository\ShopRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ShopRepository::class)
*/
class Shop
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $label;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $code;
/**
* @ORM\Column(type="datetime")
*/
private $creation_date;
/**
* @ORM\OneToMany(targetEntity=Stock::class, mappedBy="shop")
*/
private $stocks;
/**
* @ORM\OneToMany(targetEntity=Discount::class, mappedBy="shop")
*/
private $discounts;
/**
* @ORM\OneToMany(targetEntity=UserShop::class, mappedBy="shop")
*/
private $users;
/**
* @ORM\OneToMany(targetEntity=Sales::class, mappedBy="shop")
*/
private $sales;
public function __construct()
{
$this->stocks = new ArrayCollection();
$this->discounts = new ArrayCollection();
$this->users = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(?string $code): self
{
$this->code = $code;
return $this;
}
public function getCreationDate(): ?\DateTimeInterface
{
return $this->creation_date;
}
public function setCreationDate(\DateTimeInterface $creation_date): self
{
$this->creation_date = $creation_date;
return $this;
}
/**
* @return Collection<int, Stock>
*/
public function getStocks(): Collection
{
return $this->stocks;
}
public function addStock(Stock $stock): self
{
if (!$this->stocks->contains($stock)) {
$this->stocks[] = $stock;
$stock->setShop($this);
}
return $this;
}
public function removeStock(Stock $stock): self
{
if ($this->stocks->removeElement($stock)) {
// set the owning side to null (unless already changed)
if ($stock->getShop() === $this) {
$stock->setShop(null);
}
}
return $this;
}
/**
* @return Collection<int, Discount>
*/
public function getDiscounts(): Collection
{
return $this->discounts;
}
public function addDiscount(Discount $discount): self
{
if (!$this->discounts->contains($discount)) {
$this->discounts[] = $discount;
$discount->setShop($this);
}
return $this;
}
public function removeDiscount(Discount $discount): self
{
if ($this->discounts->removeElement($discount)) {
// set the owning side to null (unless already changed)
if ($discount->getShop() === $this) {
$discount->setShop(null);
}
}
return $this;
}
/**
* @return Collection<int, UserShop>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(UserShop $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setShop($this);
}
return $this;
}
public function removeUser(UserShop $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getShop() === $this) {
$user->setShop(null);
}
}
return $this;
}
/**
* @return mixed
*/
public function getSales()
{
return $this->sales;
}
/**
* @param mixed $sales
*/
public function setSales($sales): void
{
$this->sales = $sales;
}
}