src/Entity/Webfactory/Widget/Createur/Faq.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Webfactory\Widget\Createur;
  3. use App\Entity\Adherent\Magasin;
  4. use App\Entity\Webfactory\Widget\FaqContenu;
  5. use App\Entity\Webfactory\Widget\WidgetAbstract;
  6. use App\Repository\Webfactory\Widget\Createur\FaqRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. #[ORM\Table('widget_faq_createur')]
  11. #[ORM\Entity(repositoryClassFaqRepository::class)]
  12. class Faq extends WidgetAbstract
  13. {
  14.     #[ORM\Column(length255)]
  15.     private ?string $titre null;
  16.     #[ORM\Column]
  17.     private ?\DateTimeImmutable $created_at null;
  18.     #[ORM\Column]
  19.     private ?\DateTimeImmutable $updated_at null;
  20.     #[ORM\OneToMany(mappedBy'faq_createur'targetEntityFaqContenu::class, cascade: ['persist''remove'])]
  21.     private Collection $faqContenus;
  22.     public function __construct()
  23.     {
  24.         $this->created_at = new \DateTimeImmutable('now');
  25.         $this->updated_at = new \DateTimeImmutable('now');
  26.         $this->faqContenus = new ArrayCollection();
  27.     }
  28.     public function getAdherent(): ?Magasin
  29.     {
  30.         return $this->adherent;
  31.     }
  32.     public function setAdherent(?Magasin $adherent): static
  33.     {
  34.         $this->adherent $adherent;
  35.         return $this;
  36.     }
  37.     public function getCreatedAt(): ?\DateTimeImmutable
  38.     {
  39.         return $this->created_at;
  40.     }
  41.     public function setCreatedAt(\DateTimeImmutable $created_at): static
  42.     {
  43.         $this->created_at $created_at;
  44.         return $this;
  45.     }
  46.     public function getUpdatedAt(): ?\DateTimeImmutable
  47.     {
  48.         return $this->updated_at;
  49.     }
  50.     public function setUpdatedAt(\DateTimeImmutable $updated_at): static
  51.     {
  52.         $this->updated_at $updated_at;
  53.         return $this;
  54.     }
  55.     public function getTitre(): ?string
  56.     {
  57.         return $this->titre;
  58.     }
  59.     public function setTitre(string $titre): static
  60.     {
  61.         $this->titre $titre;
  62.         return $this;
  63.     }
  64.     /**
  65.      * @return Collection<int, FaqContenu>
  66.      */
  67.     public function getFaqContenus(): Collection
  68.     {
  69.         return $this->faqContenus;
  70.     }
  71.     public function addFaqContenu(FaqContenu $faqContenu): static
  72.     {
  73.         if (!$this->faqContenus->contains($faqContenu)) {
  74.             $this->faqContenus->add($faqContenu);
  75.             $faqContenu->setFaqClassique($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function removeFaqContenu(FaqContenu $faqContenu): static
  80.     {
  81.         if ($this->faqContenus->removeElement($faqContenu)) {
  82.             // set the owning side to null (unless already changed)
  83.             if ($faqContenu->getFaqClassique() === $this) {
  84.                 $faqContenu->setFaqClassique(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89. }