<?phpnamespace App\Entity;use App\Repository\StockRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=StockRepository::class) */class Stock{ public const EXPORT_FIELDS = [ 'reference' => 'Produit', 'code' => 'Code', 'price' => 'Prix', 'stock' => 'Stock' ]; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Produit::class, inversedBy="stocks") */ private $produit; /** * @ORM\ManyToOne(targetEntity=Siege::class, inversedBy="stocks") */ private $siege; /** * @ORM\Column(type="integer") */ private $stock; /** * @ORM\OneToMany(targetEntity=StockUser::class, mappedBy="stock") */ private $stockUsers; /** * @ORM\Column(type="integer", options={"default": 0}) */ private $stockInitial; public function __construct() { $this->stockUsers = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getProduit(): ?Produit { return $this->produit; } public function setProduit(?Produit $produit): self { $this->produit = $produit; return $this; } public function getSiege(): ?Siege { return $this->siege; } public function setSiege(?Siege $siege): self { $this->siege = $siege; return $this; } public function getStock(): ?int { return $this->stock; } public function setStock(int $stock): self { $this->stock = $stock; return $this; } /** * @return Collection<int, StockUser> */ public function getStockUsers(): Collection { return $this->stockUsers; } public function addStockUser(StockUser $stockUser): self { if (!$this->stockUsers->contains($stockUser)) { $this->stockUsers[] = $stockUser; $stockUser->setStock($this); } return $this; } public function removeStockUser(StockUser $stockUser): self { if ($this->stockUsers->removeElement($stockUser)) { // set the owning side to null (unless already changed) if ($stockUser->getStock() === $this) { $stockUser->setStock(null); } } return $this; } public function getStockInitial(): ?int { return $this->stockInitial; } public function setStockInitial(int $stockInitial): self { $this->stockInitial = $stockInitial; return $this; }}