tqtencore

tjr
This commit is contained in:
allavenavr 2024-10-17 17:56:46 +02:00 committed by bourgoino
parent c84c7c4c49
commit ac42fb9f85
4 changed files with 137 additions and 178 deletions

View File

@ -5,7 +5,6 @@ namespace App\Entity;
use App\Repository\AnnouncementRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AnnouncementRepository::class)]
@ -22,32 +21,30 @@ class Announcement
#[ORM\Column(length: 255)]
private ?string $description = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $creationDate = null;
#[ORM\ManyToOne(inversedBy: 'announcements')]
#[ORM\JoinColumn(nullable: false)]
private ?Company $company = null;
#[ORM\Column(length: 255,nullable: false)]
private ?string $status = "notVerified";
#[ORM\ManyToOne(inversedBy: 'announcements')]
#[ORM\JoinColumn(nullable: false)]
private ?Status $status = null;
/**
* @var ?Collection<int, InternApplication>
* @var Collection<int, Intern>
*/
#[ORM\OneToMany(targetEntity: InternApplication::class, mappedBy: 'application')]
private ?Collection $applicants;
#[ORM\ManyToMany(targetEntity: Intern::class, mappedBy: 'favorites')]
private Collection $internsfav;
/**
* @var ?Collection<int, InternFavorite>
* @var Collection<int, Intern>
*/
#[ORM\OneToMany(targetEntity: InternFavorite::class, mappedBy: 'announcement')]
private ?Collection $favoritesInterns;
#[ORM\ManyToMany(targetEntity: Intern::class, mappedBy: 'applications')]
private Collection $applicants;
public function __construct()
{
$this->internsfav = new ArrayCollection();
$this->applicants = new ArrayCollection();
$this->favoritesInterns = new ArrayCollection();
}
public function getId(): ?int
@ -91,7 +88,7 @@ class Announcement
return $this;
}
public function getStatus(): ?string
public function getStatus(): ?Status
{
return $this->status;
}
@ -104,74 +101,56 @@ class Announcement
}
/**
* @return Collection<int, InternApplication>
* @return Collection<int, Intern>
*/
public function getApplicants(): Collection
public function getInternsfav(): Collection
{
return $this->applicants;
return $this->internsfav;
}
public function addApplicants(InternApplication $applicants): static
public function addInternfav(Intern $intern): static
{
if (!$this->applicants->contains($applicants)) {
$this->applicants->add($applicants);
$applicants->setApplication($this);
if (!$this->internsfav->contains($intern)) {
$this->internsfav->add($intern);
$intern->addFavorite($this);
}
return $this;
}
public function removeApplicants(InternApplication $applicants): static
public function removeInternfav(Intern $intern): static
{
if ($this->applicants->removeElement($applicants)) {
// set the owning side to null (unless already changed)
if ($applicants->getApplication() === $this) {
$applicants->setApplication(null);
}
if ($this->internsfav->removeElement($intern)) {
$intern->removeFavorite($this);
}
return $this;
}
/**
* @return Collection<int, InternFavorite>
* @return Collection<int, Intern>
*/
public function getFavoritesInterns(): Collection
public function getApplicants(): Collection
{
return $this->favoritesInterns;
return $this->applicants;
}
public function addFavoritesIntern(InternFavorite $favoritesIntern): static
public function addApplicant(Intern $applicant): static
{
if (!$this->favoritesInterns->contains($favoritesIntern)) {
$this->favoritesInterns->add($favoritesIntern);
$favoritesIntern->setAnnouncement($this);
if (!$this->applicants->contains($applicant)) {
$this->applicants->add($applicant);
$applicant->addApplication($this);
}
return $this;
}
public function removeFavoritesIntern(InternFavorite $favoritesIntern): static
public function removeApplicant(Intern $applicant): static
{
if ($this->favoritesInterns->removeElement($favoritesIntern)) {
// set the owning side to null (unless already changed)
if ($favoritesIntern->getAnnouncement() === $this) {
$favoritesIntern->setAnnouncement(null);
}
if ($this->applicants->removeElement($applicant)) {
$applicant->removeApplication($this);
}
return $this;
}
public function getCreationDate(): ?\DateTimeInterface
{
return $this->creationDate;
}
public function setCreationDate(\DateTimeInterface $creationDate): static
{
$this->creationDate = $creationDate;
return $this;
}
}

View File

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

36
src/Entity/Obtaining.php Normal file
View File

@ -0,0 +1,36 @@
<?php
namespace App\Entity;
use App\Repository\ObtainingRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ObtainingRepository::class)]
class Obtaining
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $date = null;
public function getId(): ?int
{
return $this->id;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): static
{
$this->date = $date;
return $this;
}
}

View File

@ -19,9 +19,9 @@ class Skill
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;
public function __construct()
@ -47,30 +47,27 @@ class Skill
}
/**
* @return Collection<int, InternSkill>
* @return Collection<int, Intern>
*/
public function getInterns(): Collection
{
return $this->interns;
}
public function addIntern(InternSkill $intern): static
public function addIntern(Intern $intern): static
{
if (!$this->interns->contains($intern)) {
$this->interns->add($intern);
$intern->setSkill($this);
$intern->addSkill($this);
}
return $this;
}
public function removeIntern(InternSkill $intern): static
public function removeIntern(Intern $intern): static
{
if ($this->interns->removeElement($intern)) {
// set the owning side to null (unless already changed)
if ($intern->getSkill() === $this) {
$intern->setSkill(null);
}
$intern->removeSkill($this);
}
return $this;