src/Entity/Stock.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Participation\Participation;
  4. use App\Repository\StockRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassStockRepository::class)]
  9. class Stock
  10. {
  11.     const PARLIER_03 'PAL03';
  12.     const PARLIER_04 'PAL04';
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $label null;
  19.     #[ORM\Column(length10nullabletrue)]
  20.     private ?string $op_code null;
  21.     #[ORM\Column]
  22.     private ?int $initial_stock null;
  23.     #[ORM\Column]
  24.     private ?int $stock null;
  25.     #[ORM\Column(length10)]
  26.     private ?string $pal null;
  27.     #[ORM\ManyToMany(targetEntityParticipation::class, mappedBy'stocks')]
  28.     private Collection $participations;
  29.     #[ORM\Column(length30nullabletrue)]
  30.     private ?string $photo null;
  31.     public function __construct()
  32.     {
  33.         $this->participations = new ArrayCollection();
  34.     }
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getLabel(): ?string
  40.     {
  41.         return $this->label;
  42.     }
  43.     public function setLabel(string $label): static
  44.     {
  45.         $this->label $label;
  46.         return $this;
  47.     }
  48.     public function getOpCode(): ?string
  49.     {
  50.         return $this->op_code;
  51.     }
  52.     public function setOpCode(?string $op_code): static
  53.     {
  54.         $this->op_code $op_code;
  55.         return $this;
  56.     }
  57.     public function getInitialStock(): ?int
  58.     {
  59.         return $this->initial_stock;
  60.     }
  61.     public function setInitialStock(int $initial_stock): static
  62.     {
  63.         $this->initial_stock $initial_stock;
  64.         return $this;
  65.     }
  66.     public function getStock(): ?int
  67.     {
  68.         return $this->stock;
  69.     }
  70.     public function setStock(int $stock): static
  71.     {
  72.         $this->stock $stock;
  73.         return $this;
  74.     }
  75.     public function getPal(): ?string
  76.     {
  77.         return $this->pal;
  78.     }
  79.     public function setPal(string $pal): static
  80.     {
  81.         $this->pal $pal;
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return Collection<int, Participation>
  86.      */
  87.     public function getParticipations(): Collection
  88.     {
  89.         return $this->participations;
  90.     }
  91.     public function addParticipation(Participation $participation): static
  92.     {
  93.         if (!$this->participations->contains($participation)) {
  94.             $this->participations->add($participation);
  95.             $participation->addStock($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeParticipation(Participation $participation): static
  100.     {
  101.         if ($this->participations->removeElement($participation)) {
  102.             $participation->removeStock($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function getPhoto(): ?string
  107.     {
  108.         return $this->photo;
  109.     }
  110.     public function setPhoto(?string $photo): static
  111.     {
  112.         $this->photo $photo;
  113.         return $this;
  114.     }
  115. }