src/Entity/Product/Product.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Product;
  3. use App\Entity\Configuration\Survey;
  4. use App\Entity\Request\RequestForm;
  5. use App\Repository\Product\ProductRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassProductRepository::class)]
  10. class Product
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $name null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $codeMonday null;
  20.     #[ORM\OneToMany(mappedBy'product'targetEntitySurvey::class)]
  21.     private Collection $surveys;
  22.     #[ORM\OneToMany(mappedBy'product'targetEntityRequestForm::class)]
  23.     private Collection $requestForms;
  24.     public function __construct()
  25.     {
  26.         $this->surveys = new ArrayCollection();
  27.         $this->requestForms = new ArrayCollection();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getName(): ?string
  34.     {
  35.         return $this->name;
  36.     }
  37.     public function setName(string $name): static
  38.     {
  39.         $this->name $name;
  40.         return $this;
  41.     }
  42.     public function getCodeMonday(): ?string
  43.     {
  44.         return $this->codeMonday;
  45.     }
  46.     public function setCodeMonday(string $codeMonday): static
  47.     {
  48.         $this->codeMonday $codeMonday;
  49.         return $this;
  50.     }
  51.     /**
  52.      * @return Collection<int, Survey>
  53.      */
  54.     public function getSurveys(): Collection
  55.     {
  56.         return $this->surveys;
  57.     }
  58.     public function addSurvey(Survey $survey): static
  59.     {
  60.         if (!$this->surveys->contains($survey)) {
  61.             $this->surveys->add($survey);
  62.             $survey->setProduct($this);
  63.         }
  64.         return $this;
  65.     }
  66.     public function removeSurvey(Survey $survey): static
  67.     {
  68.         if ($this->surveys->removeElement($survey)) {
  69.             // set the owning side to null (unless already changed)
  70.             if ($survey->getProduct() === $this) {
  71.                 $survey->setProduct(null);
  72.             }
  73.         }
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return Collection<int, RequestForm>
  78.      */
  79.     public function getRequestForms(): Collection
  80.     {
  81.         return $this->requestForms;
  82.     }
  83.     public function addRequestForm(RequestForm $requestForm): static
  84.     {
  85.         if (!$this->requestForms->contains($requestForm)) {
  86.             $this->requestForms->add($requestForm);
  87.             $requestForm->setProduct($this);
  88.         }
  89.         return $this;
  90.     }
  91.     public function removeRequestForm(RequestForm $requestForm): static
  92.     {
  93.         if ($this->requestForms->removeElement($requestForm)) {
  94.             // set the owning side to null (unless already changed)
  95.             if ($requestForm->getProduct() === $this) {
  96.                 $requestForm->setProduct(null);
  97.             }
  98.         }
  99.         return $this;
  100.     }
  101. }