src/Entity/Forum.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ForumRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassForumRepository::class)]
  8. class Forum
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     
  15.     #[ORM\OneToMany(targetEntityCompany::class, mappedBy'forum')]
  16.     private Collection $companies;
  17.     #[ORM\OneToMany(targetEntityCandidate::class, mappedBy'forum')]
  18.     private Collection $candidates;
  19.     #[ORM\Column(type'datetime'nullabletrue)]
  20.     private ?\DateTimeInterface $date null;
  21.     #[ORM\ManyToMany(targetEntityCampus::class, inversedBy'forums')]
  22.     private Collection $campuses;
  23.     public function __construct()
  24.     {
  25.         $this->companies = new ArrayCollection();
  26.         $this->candidates = new ArrayCollection();
  27.         $this->campuses = new ArrayCollection();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     /**
  34.      * @return Collection<int, Company>
  35.      */
  36.     public function getCompanies(): Collection
  37.     {
  38.         return $this->companies;
  39.     }
  40.     public function addCompany(Company $company): self
  41.     {
  42.         if (!$this->companies->contains($company)) {
  43.             $this->companies[] = $company;
  44.             $company->setForum($this);
  45.         }
  46.         return $this;
  47.     }
  48.     public function removeCompany(Company $company): self
  49.     {
  50.         if ($this->companies->removeElement($company)) {
  51.             // set the owning side to null (unless already changed)
  52.             if ($company->getForum() === $this) {
  53.                 $company->setForum(null);
  54.             }
  55.         }
  56.         return $this;
  57.     }
  58.     /**
  59.      * @return Collection<int, Candidate>
  60.      */
  61.     public function getCandidates(): Collection
  62.     {
  63.         return $this->candidates;
  64.     }
  65.     public function addCandidate(Candidate $candidate): self
  66.     {
  67.         if (!$this->candidates->contains($candidate)) {
  68.             $this->candidates[] = $candidate;
  69.             $candidate->setForum($this);
  70.         }
  71.         return $this;
  72.     }
  73.     public function removeCandidate(Candidate $candidate): self
  74.     {
  75.         if ($this->candidates->removeElement($candidate)) {
  76.             // set the owning side to null (unless already changed)
  77.             if ($candidate->getForum() === $this) {
  78.                 $candidate->setForum(null);
  79.             }
  80.         }
  81.         return $this;
  82.     }
  83.     public function getDate(): ?\DateTimeInterface
  84.     {
  85.         return $this->date;
  86.     }
  87.     public function setDate(?\DateTimeInterface $date): self
  88.     {
  89.         $this->date $date;
  90.         return $this;
  91.     }
  92.     /**
  93.      * @return Collection<int, Campus>
  94.      */
  95.     public function getCampuses(): Collection
  96.     {
  97.         return $this->campuses;
  98.     }
  99.     public function addCampus(Campus $campus): static
  100.     {
  101.         if (!$this->campuses->contains($campus)) {
  102.             $this->campuses->add($campus);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removeCampus(Campus $campus): static
  107.     {
  108.         $this->campuses->removeElement($campus);
  109.         return $this;
  110.     }
  111. }