<?php
namespace App\Entity\Product;
use App\Entity\Configuration\Survey;
use App\Entity\Request\RequestForm;
use App\Repository\Product\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)]
private ?string $name = null;
#[ORM\Column(length: 255)]
private ?string $codeMonday = null;
#[ORM\OneToMany(mappedBy: 'product', targetEntity: Survey::class)]
private Collection $surveys;
#[ORM\OneToMany(mappedBy: 'product', targetEntity: RequestForm::class)]
private Collection $requestForms;
public function __construct()
{
$this->surveys = new ArrayCollection();
$this->requestForms = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getCodeMonday(): ?string
{
return $this->codeMonday;
}
public function setCodeMonday(string $codeMonday): static
{
$this->codeMonday = $codeMonday;
return $this;
}
/**
* @return Collection<int, Survey>
*/
public function getSurveys(): Collection
{
return $this->surveys;
}
public function addSurvey(Survey $survey): static
{
if (!$this->surveys->contains($survey)) {
$this->surveys->add($survey);
$survey->setProduct($this);
}
return $this;
}
public function removeSurvey(Survey $survey): static
{
if ($this->surveys->removeElement($survey)) {
// set the owning side to null (unless already changed)
if ($survey->getProduct() === $this) {
$survey->setProduct(null);
}
}
return $this;
}
/**
* @return Collection<int, RequestForm>
*/
public function getRequestForms(): Collection
{
return $this->requestForms;
}
public function addRequestForm(RequestForm $requestForm): static
{
if (!$this->requestForms->contains($requestForm)) {
$this->requestForms->add($requestForm);
$requestForm->setProduct($this);
}
return $this;
}
public function removeRequestForm(RequestForm $requestForm): static
{
if ($this->requestForms->removeElement($requestForm)) {
// set the owning side to null (unless already changed)
if ($requestForm->getProduct() === $this) {
$requestForm->setProduct(null);
}
}
return $this;
}
}