ajout diplome et message + gestion des relations
This commit is contained in:
parent
65f5c8cce4
commit
0e2a2f25f6
@ -19,30 +19,35 @@ class Intern extends UserApp
|
|||||||
private ?string $resume = null;
|
private ?string $resume = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, Announcement>
|
* @var Collection<int, InternDegree>
|
||||||
*/
|
*/
|
||||||
#[ORM\ManyToMany(targetEntity: Announcement::class, inversedBy: 'interns')]
|
#[ORM\OneToMany(targetEntity: InternDegree::class, mappedBy: 'intern')]
|
||||||
#[ORM\JoinTable(name: 'favorites')]
|
private Collection $degrees;
|
||||||
private Collection $favorites;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, Announcement>
|
* @var Collection<int, InternSkill>
|
||||||
*/
|
*/
|
||||||
#[ORM\ManyToMany(targetEntity: Announcement::class, inversedBy: 'applicants')]
|
#[ORM\OneToMany(targetEntity: InternSkill::class, mappedBy: 'intern')]
|
||||||
#[ORM\JoinTable(name: 'applications')]
|
private Collection $skills;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, InternApplication>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(targetEntity: InternApplication::class, mappedBy: 'intern')]
|
||||||
private Collection $applications;
|
private Collection $applications;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, Skill>
|
* @var Collection<int, InternFavorite>
|
||||||
*/
|
*/
|
||||||
#[ORM\ManyToMany(targetEntity: Skill::class, inversedBy: 'interns')]
|
#[ORM\OneToMany(targetEntity: InternFavorite::class, mappedBy: 'intern')]
|
||||||
private Collection $skills;
|
private Collection $favorites;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->favorites = new ArrayCollection();
|
$this->degrees = new ArrayCollection();
|
||||||
$this->applications = new ArrayCollection();
|
|
||||||
$this->skills = new ArrayCollection();
|
$this->skills = new ArrayCollection();
|
||||||
|
$this->applications = new ArrayCollection();
|
||||||
|
$this->favorites = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCoverLetter(): ?string
|
public function getCoverLetter(): ?string
|
||||||
@ -70,73 +75,121 @@ class Intern extends UserApp
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection<int, Announcement>
|
* @return Collection<int, InternDegree>
|
||||||
*/
|
*/
|
||||||
public function getFavorites(): Collection
|
public function getDegrees(): Collection
|
||||||
{
|
{
|
||||||
return $this->favorites;
|
return $this->degrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addFavorite(Announcement $favorite): static
|
public function addDegree(InternDegree $degree): static
|
||||||
{
|
{
|
||||||
if (!$this->favorites->contains($favorite)) {
|
if (!$this->degrees->contains($degree)) {
|
||||||
$this->favorites->add($favorite);
|
$this->degrees->add($degree);
|
||||||
|
$degree->setIntern($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeFavorite(Announcement $favorite): static
|
public function removeDegree(InternDegree $degree): static
|
||||||
{
|
{
|
||||||
$this->favorites->removeElement($favorite);
|
if ($this->degrees->removeElement($degree)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($degree->getIntern() === $this) {
|
||||||
|
$degree->setIntern(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection<int, Announcement>
|
* @return Collection<int, InternSkill>
|
||||||
*/
|
|
||||||
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
|
public function getSkills(): Collection
|
||||||
{
|
{
|
||||||
return $this->skills;
|
return $this->skills;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addSkill(Skill $skill): static
|
public function addSkill(InternSkill $skill): static
|
||||||
{
|
{
|
||||||
if (!$this->skills->contains($skill)) {
|
if (!$this->skills->contains($skill)) {
|
||||||
$this->skills->add($skill);
|
$this->skills->add($skill);
|
||||||
|
$skill->setIntern($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeSkill(Skill $skill): static
|
public function removeSkill(InternSkill $skill): static
|
||||||
{
|
{
|
||||||
$this->skills->removeElement($skill);
|
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
|
||||||
|
{
|
||||||
|
return $this->favorites;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addFavorite(InternFavorite $favorite): static
|
||||||
|
{
|
||||||
|
if (!$this->favorites->contains($favorite)) {
|
||||||
|
$this->favorites->add($favorite);
|
||||||
|
$favorite->setIntern($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeFavorite(InternFavorite $favorite): static
|
||||||
|
{
|
||||||
|
if ($this->favorites->removeElement($favorite)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($favorite->getIntern() === $this) {
|
||||||
|
$favorite->setIntern(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@ class Skill
|
|||||||
private ?string $label = null;
|
private ?string $label = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, Intern>
|
* @var Collection<int, InternSkill>
|
||||||
*/
|
*/
|
||||||
#[ORM\ManyToMany(targetEntity: Intern::class, mappedBy: 'skills')]
|
#[ORM\OneToMany(targetEntity: InternSkill::class, mappedBy: 'skill')]
|
||||||
private Collection $interns;
|
private Collection $interns;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -47,27 +47,30 @@ class Skill
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection<int, Intern>
|
* @return Collection<int, InternSkill>
|
||||||
*/
|
*/
|
||||||
public function getInterns(): Collection
|
public function getInterns(): Collection
|
||||||
{
|
{
|
||||||
return $this->interns;
|
return $this->interns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addIntern(Intern $intern): static
|
public function addIntern(InternSkill $intern): static
|
||||||
{
|
{
|
||||||
if (!$this->interns->contains($intern)) {
|
if (!$this->interns->contains($intern)) {
|
||||||
$this->interns->add($intern);
|
$this->interns->add($intern);
|
||||||
$intern->addSkill($this);
|
$intern->setSkill($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeIntern(Intern $intern): static
|
public function removeIntern(InternSkill $intern): static
|
||||||
{
|
{
|
||||||
if ($this->interns->removeElement($intern)) {
|
if ($this->interns->removeElement($intern)) {
|
||||||
$intern->removeSkill($this);
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($intern->getSkill() === $this) {
|
||||||
|
$intern->setSkill(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
Loading…
Reference in New Issue
Block a user