src/Entity/Product.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Participation\Participation;
  4. use App\Repository\ProductRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassProductRepository::class)]
  9. class Product
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255nullabletrue)]
  16.     private ?string $carrier null;
  17.     #[ORM\Column(length5nullabletrue)]
  18.     private ?string $barcodeStatus null;
  19.     #[ORM\OneToMany(mappedBy'ean'targetEntityParticipation::class)]
  20.     private Collection $participations;
  21.     public function __construct()
  22.     {
  23.         $this->participations = new ArrayCollection();
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getCarrier(): ?string
  30.     {
  31.         return $this->carrier;
  32.     }
  33.     public function setCarrier(?string $carrier): self
  34.     {
  35.         $this->carrier $carrier;
  36.         return $this;
  37.     }
  38.     public function getBarcodeStatus(): ?string
  39.     {
  40.         return $this->barcodeStatus;
  41.     }
  42.     public function setBarcodeStatus(?string $barcodeStatus): self
  43.     {
  44.         $this->barcodeStatus $barcodeStatus;
  45.         return $this;
  46.     }
  47.     /**
  48.      * @return Collection<int, Participation>
  49.      */
  50.     public function getParticipations(): Collection
  51.     {
  52.         return $this->participations;
  53.     }
  54.     public function addParticipation(Participation $participation): static
  55.     {
  56.         if (!$this->participations->contains($participation)) {
  57.             $this->participations->add($participation);
  58.             $participation->setEan($this);
  59.         }
  60.         return $this;
  61.     }
  62.     public function removeParticipation(Participation $participation): static
  63.     {
  64.         if ($this->participations->removeElement($participation)) {
  65.             // set the owning side to null (unless already changed)
  66.             if ($participation->getEan() === $this) {
  67.                 $participation->setEan(null);
  68.             }
  69.         }
  70.         return $this;
  71.     }
  72. }