src/Entity/Product.php line 12
<?php
namespace App\Entity;
use App\Entity\Participation\Participation;
use App\Repository\ProductRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ProductRepository::class)]
class Product
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $carrier = null;
#[ORM\Column(length: 5, nullable: true)]
private ?string $barcodeStatus = null;
#[ORM\OneToMany(mappedBy: 'ean', targetEntity: Participation::class)]
private Collection $participations;
public function __construct()
{
$this->participations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCarrier(): ?string
{
return $this->carrier;
}
public function setCarrier(?string $carrier): self
{
$this->carrier = $carrier;
return $this;
}
public function getBarcodeStatus(): ?string
{
return $this->barcodeStatus;
}
public function setBarcodeStatus(?string $barcodeStatus): self
{
$this->barcodeStatus = $barcodeStatus;
return $this;
}
/**
* @return Collection<int, Participation>
*/
public function getParticipations(): Collection
{
return $this->participations;
}
public function addParticipation(Participation $participation): static
{
if (!$this->participations->contains($participation)) {
$this->participations->add($participation);
$participation->setEan($this);
}
return $this;
}
public function removeParticipation(Participation $participation): static
{
if ($this->participations->removeElement($participation)) {
// set the owning side to null (unless already changed)
if ($participation->getEan() === $this) {
$participation->setEan(null);
}
}
return $this;
}
}