tqtencore

tjr
This commit is contained in:
allavenavr 2024-10-17 17:56:46 +02:00 committed by bourgoino
parent f244e51aa7
commit 65f5c8cce4
2 changed files with 70 additions and 126 deletions

View File

@ -19,35 +19,30 @@ class Intern extends UserApp
private ?string $resume = null; private ?string $resume = null;
/** /**
* @var Collection<int, InternDegree> * @var Collection<int, Announcement>
*/ */
#[ORM\OneToMany(targetEntity: InternDegree::class, mappedBy: 'intern')] #[ORM\ManyToMany(targetEntity: Announcement::class, inversedBy: 'interns')]
private Collection $degrees; #[ORM\JoinTable(name: 'favorites')]
private Collection $favorites;
/** /**
* @var Collection<int, InternSkill> * @var Collection<int, Announcement>
*/ */
#[ORM\OneToMany(targetEntity: InternSkill::class, mappedBy: 'intern')] #[ORM\ManyToMany(targetEntity: Announcement::class, inversedBy: 'applicants')]
private Collection $skills; #[ORM\JoinTable(name: 'applications')]
/**
* @var Collection<int, InternApplication>
*/
#[ORM\OneToMany(targetEntity: InternApplication::class, mappedBy: 'intern')]
private Collection $applications; private Collection $applications;
/** /**
* @var Collection<int, InternFavorite> * @var Collection<int, Skill>
*/ */
#[ORM\OneToMany(targetEntity: InternFavorite::class, mappedBy: 'intern')] #[ORM\ManyToMany(targetEntity: Skill::class, inversedBy: 'interns')]
private Collection $favorites; private Collection $skills;
public function __construct() public function __construct()
{ {
$this->degrees = new ArrayCollection();
$this->skills = new ArrayCollection();
$this->applications = new ArrayCollection();
$this->favorites = new ArrayCollection(); $this->favorites = new ArrayCollection();
$this->applications = new ArrayCollection();
$this->skills = new ArrayCollection();
} }
public function getCoverLetter(): ?string public function getCoverLetter(): ?string
@ -75,122 +70,74 @@ class Intern extends UserApp
} }
/** /**
* @return Collection<int, InternDegree> * @return Collection<int, Announcement>
*/
public function getDegrees(): Collection
{
return $this->degrees;
}
public function addDegree(InternDegree $degree): static
{
if (!$this->degrees->contains($degree)) {
$this->degrees->add($degree);
$degree->setIntern($this);
}
return $this;
}
public function removeDegree(InternDegree $degree): static
{
if ($this->degrees->removeElement($degree)) {
// set the owning side to null (unless already changed)
if ($degree->getIntern() === $this) {
$degree->setIntern(null);
}
}
return $this;
}
/**
* @return Collection<int, InternSkill>
*/
public function getSkills(): Collection
{
return $this->skills;
}
public function addSkill(InternSkill $skill): static
{
if (!$this->skills->contains($skill)) {
$this->skills->add($skill);
$skill->setIntern($this);
}
return $this;
}
public function removeSkill(InternSkill $skill): static
{
if ($this->skills->removeElement($skill)) {
// set the owning side to null (unless already changed)
if ($skill->getIntern() === $this) {
$skill->setIntern(null);
}
}
return $this;
}
/**
* @return Collection<int, InternApplication>
*/
public function getApplications(): Collection
{
return $this->applications;
}
public function addApplication(InternApplication $application): static
{
if (!$this->applications->contains($application)) {
$this->applications->add($application);
$application->setIntern($this);
}
return $this;
}
public function removeApplication(InternApplication $application): static
{
if ($this->applications->removeElement($application)) {
// set the owning side to null (unless already changed)
if ($application->getIntern() === $this) {
$application->setIntern(null);
}
}
return $this;
}
/**
* @return Collection<int, InternFavorite>
*/ */
public function getFavorites(): Collection public function getFavorites(): Collection
{ {
return $this->favorites; return $this->favorites;
} }
public function addFavorite(InternFavorite $favorite): static public function addFavorite(Announcement $favorite): static
{ {
if (!$this->favorites->contains($favorite)) { if (!$this->favorites->contains($favorite)) {
$this->favorites->add($favorite); $this->favorites->add($favorite);
$favorite->setIntern($this);
} }
return $this; return $this;
} }
public function removeFavorite(InternFavorite $favorite): static public function removeFavorite(Announcement $favorite): static
{ {
if ($this->favorites->removeElement($favorite)) { $this->favorites->removeElement($favorite);
// set the owning side to null (unless already changed)
if ($favorite->getIntern() === $this) { return $this;
$favorite->setIntern(null);
} }
/**
* @return Collection<int, Announcement>
*/
public function getApplications(): Collection
{
return $this->applications;
} }
public function addApplication(Announcement $application): static
{
if (!$this->applications->contains($application)) {
$this->applications->add($application);
}
return $this;
}
public function removeApplication(Announcement $application): static
{
$this->applications->removeElement($application);
return $this;
}
/**
* @return Collection<int, Skill>
*/
public function getSkills(): Collection
{
return $this->skills;
}
public function addSkill(Skill $skill): static
{
if (!$this->skills->contains($skill)) {
$this->skills->add($skill);
}
return $this;
}
public function removeSkill(Skill $skill): static
{
$this->skills->removeElement($skill);
return $this; return $this;
} }
} }

View File

@ -19,9 +19,9 @@ class Skill
private ?string $label = null; private ?string $label = null;
/** /**
* @var Collection<int, InternSkill> * @var Collection<int, Intern>
*/ */
#[ORM\OneToMany(targetEntity: InternSkill::class, mappedBy: 'skill')] #[ORM\ManyToMany(targetEntity: Intern::class, mappedBy: 'skills')]
private Collection $interns; private Collection $interns;
public function __construct() public function __construct()
@ -47,30 +47,27 @@ class Skill
} }
/** /**
* @return Collection<int, InternSkill> * @return Collection<int, Intern>
*/ */
public function getInterns(): Collection public function getInterns(): Collection
{ {
return $this->interns; return $this->interns;
} }
public function addIntern(InternSkill $intern): static public function addIntern(Intern $intern): static
{ {
if (!$this->interns->contains($intern)) { if (!$this->interns->contains($intern)) {
$this->interns->add($intern); $this->interns->add($intern);
$intern->setSkill($this); $intern->addSkill($this);
} }
return $this; return $this;
} }
public function removeIntern(InternSkill $intern): static public function removeIntern(Intern $intern): static
{ {
if ($this->interns->removeElement($intern)) { if ($this->interns->removeElement($intern)) {
// set the owning side to null (unless already changed) $intern->removeSkill($this);
if ($intern->getSkill() === $this) {
$intern->setSkill(null);
}
} }
return $this; return $this;