<?php
namespace App\Entity;
use App\Repository\ConsultantsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ConsultantsRepository::class)]
class Consultants extends User
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 50)]
private $nom;
#[ORM\Column(type: 'string', length: 50)]
private $prenom;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private $intitule_post;
#[ORM\Column(type: 'float', nullable: true)]
private $TJM;
#[ORM\Column(type: 'boolean', nullable: true)]
private $dispo_teletravail;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $lien_linkedin;
#[ORM\Column(type: 'date', nullable: true)]
private $debut_disponibilite;
#[ORM\Column(type: 'text', nullable: true)]
private $descriptif;
#[ORM\Column(type: 'integer', nullable: true)]
private $experience;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $CV;
#[ORM\Column(type: 'blob', nullable: true)]
private $photo;
#[ORM\Column(type: 'string', length: 50)]
private $num_kbis;
//fayeza
#[ORM\ManyToOne(targetEntity: Localisation::class, cascade: ['persist', 'remove'])]
private $localisation;
#[ORM\ManyToMany(targetEntity: Metiers::class)]
private $metier;
#[ORM\ManyToMany(targetEntity: Competences::class)]
private $competence;
#[ORM\ManyToMany(targetEntity: NiveauEtude::class)]
private $niveau_etude;
#[ORM\OneToMany(mappedBy: 'consultant', targetEntity: EvaluationCON::class)]
private $evaluationCONs;
#[ORM\OneToMany(mappedBy: 'consultant', targetEntity: AvisComerciaux::class)]
private $avisComerciauxes;
#[ORM\OneToMany(mappedBy: 'consultant', targetEntity: AvisConsultant::class)]
private $avisConsultants;
#[ORM\Column(type: 'string', length: 100, nullable: true)]
private $ville;
#[ORM\Column(type: 'string', length: 20)]
private $cp;
#[ORM\ManyToMany(targetEntity: Missions::class, mappedBy: 'favoris')]
private Collection $favoris;
public function __construct()
{
$this->metier = new ArrayCollection();
$this->competence = new ArrayCollection();
$this->niveau_etude = new ArrayCollection();
$this->evaluationCONs = new ArrayCollection();
$this->avisComerciauxes = new ArrayCollection();
$this->avisConsultants = new ArrayCollection();
$this->favoris = new ArrayCollection();
}
// Dans la classe Consultant (la classe enfant)
public function __serialize(): array
{
$data = parent::__serialize(); // Appeler la sérialisation de la classe parente
$data['nom'] = $this->nom;
$data['prenom'] = $this->prenom;
$data['ville'] = $this->ville;
$data['cp'] = $this->cp;
$data['intitule_post'] = $this->intitule_post;
$data['TJM'] = $this->TJM;
$data['lien_linkedin'] = $this->lien_linkedin;
$data['num_kbis'] = $this->num_kbis;
$data['CV'] = $this->CV;
return $data;
}
// Dans la classe Consultant (la classe enfant)
public function __unserialize(array $data): void
{
parent::__unserialize($data); // Restaurer les données de la classe parente
$this->nom = $data['nom'] ?? null;
$this->prenom = $data['prenom'] ?? null;
$this->ville = $data['ville'] ?? null;
$this->cp = $data['cp'] ?? null;
$this->intitule_post = $data['intitule_post'] ?? null;
$this->TJM = $data['TJM'] ?? null;
$this->lien_linkedin = $data['lien_linkedin'] ?? null;
$this->num_kbis = $data['num_kbis'] ?? null;
$this->CV = $data['CV'] ?? null;
}
public function getIdCon(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getPrenom(): ?string
{
return $this->prenom;
}
public function setPrenom(string $prenom): self
{
$this->prenom = $prenom;
return $this;
}
public function getIntitulePost(): ?string
{
return $this->intitule_post;
}
public function setIntitulePost(?string $intitule_post): self
{
$this->intitule_post = $intitule_post;
return $this;
}
public function getTJM(): ?float
{
return $this->TJM;
}
public function setTJM(float $TJM): self
{
$this->TJM = $TJM;
return $this;
}
public function isDispoTeletravail(): ?bool
{
return $this->dispo_teletravail;
}
public function setDispoTeletravail(bool $dispo_teletravail): self
{
$this->dispo_teletravail = $dispo_teletravail;
return $this;
}
public function getLienLinkedin(): ?string
{
return $this->lien_linkedin;
}
public function setLienLinkedin(?string $lien_linkedin): self
{
$this->lien_linkedin = $lien_linkedin;
return $this;
}
public function getDebutDisponibilite(): ?\DateTimeInterface
{
return $this->debut_disponibilite;
}
public function setDebutDisponibilite(?\DateTimeInterface $debut_disponibilite): self
{
$this->debut_disponibilite = $debut_disponibilite;
return $this;
}
public function getDescriptif(): ?string
{
return $this->descriptif;
}
public function setDescriptif(?string $descriptif): self
{
$this->descriptif = $descriptif;
return $this;
}
public function getExperience(): ?int
{
return $this->experience;
}
public function setExperience(?int $experience): self
{
$this->experience = $experience;
return $this;
}
public function getCV(): ?string
{
return $this->CV;
}
public function setCV(?string $CV): self
{
$this->CV = $CV;
return $this;
}
public function getPhoto()
{
return $this->photo;
}
public function setPhoto($photo): self
{
$this->photo = $photo;
return $this;
}
public function getNumKbis(): ?string
{
return $this->num_kbis;
}
public function setNumKbis(string $num_kbis): self
{
$this->num_kbis = $num_kbis;
return $this;
}
public function getLocalisation(): ?Localisation
{
return $this->localisation;
}
public function setLocalisation(?Localisation $localisation): self
{
$this->localisation = $localisation;
return $this;
}
/**
* @return Collection<int, Metiers>
*/
public function getMetier(): Collection
{
return $this->metier;
}
public function addMetier(Metiers $metier): self
{
if (!$this->metier->contains($metier)) {
$this->metier[] = $metier;
}
return $this;
}
public function removeMetier(Metiers $metier): self
{
$this->metier->removeElement($metier);
return $this;
}
/**
* @return Collection<int, Competences>
*/
public function getCompetence(): Collection
{
return $this->competence;
}
public function addCompetence(Competences $competence): self
{
if (!$this->competence->contains($competence)) {
$this->competence[] = $competence;
}
return $this;
}
public function removeCompetence(Competences $competence): self
{
$this->competence->removeElement($competence);
return $this;
}
/**
* @return Collection<int, NiveauEtude>
*/
public function getNiveauEtude(): Collection
{
return $this->niveau_etude;
}
public function addNiveauEtude(NiveauEtude $niveauEtude): self
{
if (!$this->niveau_etude->contains($niveauEtude)) {
$this->niveau_etude[] = $niveauEtude;
}
return $this;
}
public function removeNiveauEtude(NiveauEtude $niveauEtude): self
{
$this->niveau_etude->removeElement($niveauEtude);
return $this;
}
/**
* @return Collection<int, EvaluationCON>
*/
public function getEvaluationCONs(): Collection
{
return $this->evaluationCONs;
}
public function addEvaluationCON(EvaluationCON $evaluationCON): self
{
if (!$this->evaluationCONs->contains($evaluationCON)) {
$this->evaluationCONs[] = $evaluationCON;
$evaluationCON->setConsultant($this);
}
return $this;
}
public function removeEvaluationCON(EvaluationCON $evaluationCON): self
{
if ($this->evaluationCONs->removeElement($evaluationCON)) {
// set the owning side to null (unless already changed)
if ($evaluationCON->getConsultant() === $this) {
$evaluationCON->setConsultant(null);
}
}
return $this;
}
/**
* @return Collection<int, AvisComerciaux>
*/
public function getAvisComerciauxes(): Collection
{
return $this->avisComerciauxes;
}
public function addAvisComerciaux(AvisComerciaux $avisComerciaux): self
{
if (!$this->avisComerciauxes->contains($avisComerciaux)) {
$this->avisComerciauxes[] = $avisComerciaux;
$avisComerciaux->setConsultant($this);
}
return $this;
}
public function removeAvisComerciaux(AvisComerciaux $avisComerciaux): self
{
if ($this->avisComerciauxes->removeElement($avisComerciaux)) {
// set the owning side to null (unless already changed)
if ($avisComerciaux->getConsultant() === $this) {
$avisComerciaux->setConsultant(null);
}
}
return $this;
}
/**
* @return Collection<int, AvisConsultant>
*/
public function getAvisConsultants(): Collection
{
return $this->avisConsultants;
}
public function addAvisConsultant(AvisConsultant $avisConsultant): self
{
if (!$this->avisConsultants->contains($avisConsultant)) {
$this->avisConsultants[] = $avisConsultant;
$avisConsultant->setConsultant($this);
}
return $this;
}
public function removeAvisConsultant(AvisConsultant $avisConsultant): self
{
if ($this->avisConsultants->removeElement($avisConsultant)) {
// set the owning side to null (unless already changed)
if ($avisConsultant->getConsultant() === $this) {
$avisConsultant->setConsultant(null);
}
}
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): self
{
$this->ville = $ville;
return $this;
}
public function getCp(): ?string
{
return $this->cp;
}
public function setCp(string $cp): self
{
$this->cp = $cp;
return $this;
}
/**
* @return Collection<int, Missions>
*/
public function getFavoris(): Collection
{
return $this->favoris;
}
public function addFavori(Missions $favori): static
{
if (!$this->favoris->contains($favori)) {
$this->favoris->add($favori);
$favori->addFavori($this);
}
return $this;
}
public function removeFavori(Missions $favori): static
{
if ($this->favoris->removeElement($favori)) {
$favori->removeFavori($this);
}
return $this;
}
}