src/Entity/EntreStock.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EntreStockRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassEntreStockRepository::class)]
  8. class EntreStock
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length50nullabletrue)]
  15.     private ?string $ref null;
  16.     #[ORM\Column]
  17.     private ?\DateTimeImmutable $createdAt null;
  18.     #[ORM\Column]
  19.     private ?float $montantTotal null;
  20.     #[ORM\ManyToOne(inversedBy'entreStocks')]
  21.     private ?Fournisseur $fournisseur null;
  22.     #[ORM\OneToMany(mappedBy'entreStock'targetEntityStock::class)]
  23.     private Collection $stocks;
  24.     public function __construct()
  25.     {
  26.         $this->stocks = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getRef(): ?string
  33.     {
  34.         return $this->ref;
  35.     }
  36.     public function setRef(?string $ref): self
  37.     {
  38.         $this->ref $ref;
  39.         return $this;
  40.     }
  41.     public function getCreatedAt(): ?\DateTimeImmutable
  42.     {
  43.         return $this->createdAt;
  44.     }
  45.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  46.     {
  47.         $this->createdAt $createdAt;
  48.         return $this;
  49.     }
  50.     public function getMontantTotal(): ?float
  51.     {
  52.         return $this->montantTotal;
  53.     }
  54.     public function setMontantTotal(float $montantTotal): self
  55.     {
  56.         $this->montantTotal $montantTotal;
  57.         return $this;
  58.     }
  59.     public function getFournisseur(): ?Fournisseur
  60.     {
  61.         return $this->fournisseur;
  62.     }
  63.     public function setFournisseur(?Fournisseur $fournisseur): self
  64.     {
  65.         $this->fournisseur $fournisseur;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @return Collection<int, Stock>
  70.      */
  71.     public function getStocks(): Collection
  72.     {
  73.         return $this->stocks;
  74.     }
  75.     public function addStock(Stock $stock): self
  76.     {
  77.         if (!$this->stocks->contains($stock)) {
  78.             $this->stocks->add($stock);
  79.             $stock->setEntreStock($this);
  80.         }
  81.         return $this;
  82.     }
  83.     public function removeStock(Stock $stock): self
  84.     {
  85.         if ($this->stocks->removeElement($stock)) {
  86.             // set the owning side to null (unless already changed)
  87.             if ($stock->getEntreStock() === $this) {
  88.                 $stock->setEntreStock(null);
  89.             }
  90.         }
  91.         return $this;
  92.     }
  93. }