<?php
namespace App\Entity;
use App\Repository\ForumRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ForumRepository::class)]
class Forum
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\OneToMany(targetEntity: Company::class, mappedBy: 'forum')]
private Collection $companies;
#[ORM\OneToMany(targetEntity: Candidate::class, mappedBy: 'forum')]
private Collection $candidates;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTimeInterface $date = null;
#[ORM\ManyToMany(targetEntity: Campus::class, inversedBy: 'forums')]
private Collection $campuses;
public function __construct()
{
$this->companies = new ArrayCollection();
$this->candidates = new ArrayCollection();
$this->campuses = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection<int, Company>
*/
public function getCompanies(): Collection
{
return $this->companies;
}
public function addCompany(Company $company): self
{
if (!$this->companies->contains($company)) {
$this->companies[] = $company;
$company->setForum($this);
}
return $this;
}
public function removeCompany(Company $company): self
{
if ($this->companies->removeElement($company)) {
// set the owning side to null (unless already changed)
if ($company->getForum() === $this) {
$company->setForum(null);
}
}
return $this;
}
/**
* @return Collection<int, Candidate>
*/
public function getCandidates(): Collection
{
return $this->candidates;
}
public function addCandidate(Candidate $candidate): self
{
if (!$this->candidates->contains($candidate)) {
$this->candidates[] = $candidate;
$candidate->setForum($this);
}
return $this;
}
public function removeCandidate(Candidate $candidate): self
{
if ($this->candidates->removeElement($candidate)) {
// set the owning side to null (unless already changed)
if ($candidate->getForum() === $this) {
$candidate->setForum(null);
}
}
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(?\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
/**
* @return Collection<int, Campus>
*/
public function getCampuses(): Collection
{
return $this->campuses;
}
public function addCampus(Campus $campus): static
{
if (!$this->campuses->contains($campus)) {
$this->campuses->add($campus);
}
return $this;
}
public function removeCampus(Campus $campus): static
{
$this->campuses->removeElement($campus);
return $this;
}
}