157 lines
3.3 KiB
PHP
157 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\AnnouncementRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: AnnouncementRepository::class)]
|
|
class Announcement
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $title = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $description = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'announcements')]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?Company $company = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'announcements')]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?Status $status = null;
|
|
|
|
/**
|
|
* @var Collection<int, Intern>
|
|
*/
|
|
#[ORM\ManyToMany(targetEntity: Intern::class, mappedBy: 'favorites')]
|
|
private Collection $internsfav;
|
|
|
|
/**
|
|
* @var Collection<int, Intern>
|
|
*/
|
|
#[ORM\ManyToMany(targetEntity: Intern::class, mappedBy: 'applications')]
|
|
private Collection $applicants;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->internsfav = new ArrayCollection();
|
|
$this->applicants = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getTitle(): ?string
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function setTitle(string $title): static
|
|
{
|
|
$this->title = $title;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDescription(): ?string
|
|
{
|
|
return $this->description;
|
|
}
|
|
|
|
public function setDescription(string $description): static
|
|
{
|
|
$this->description = $description;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCompany(): ?Company
|
|
{
|
|
return $this->company;
|
|
}
|
|
|
|
public function setCompany(?Company $company): static
|
|
{
|
|
$this->company = $company;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getStatus(): ?Status
|
|
{
|
|
return $this->status;
|
|
}
|
|
|
|
public function setStatus(?Status $status): static
|
|
{
|
|
$this->status = $status;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Intern>
|
|
*/
|
|
public function getInternsfav(): Collection
|
|
{
|
|
return $this->internsfav;
|
|
}
|
|
|
|
public function addInternfav(Intern $intern): static
|
|
{
|
|
if (!$this->internsfav->contains($intern)) {
|
|
$this->internsfav->add($intern);
|
|
$intern->addFavorite($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeInternfav(Intern $intern): static
|
|
{
|
|
if ($this->internsfav->removeElement($intern)) {
|
|
$intern->removeFavorite($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Intern>
|
|
*/
|
|
public function getApplicants(): Collection
|
|
{
|
|
return $this->applicants;
|
|
}
|
|
|
|
public function addApplicant(Intern $applicant): static
|
|
{
|
|
if (!$this->applicants->contains($applicant)) {
|
|
$this->applicants->add($applicant);
|
|
$applicant->addApplication($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeApplicant(Intern $applicant): static
|
|
{
|
|
if ($this->applicants->removeElement($applicant)) {
|
|
$applicant->removeApplication($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
}
|