src/Entity/Gestiform/Users/Employe.php line 16
<?php
namespace App\Entity\Gestiform\Users;
use App\Entity\Common\HistoriqueEmail;
use App\Entity\Gestiform\Formations\Dossier\Dossier;
use App\Entity\Gestiform\Formations\Dossier\HistoriqueDossier;
use App\Entity\Gestiform\Formations\Dossier\PersonalInformations;
use App\Repository\Gestiform\Users\EmployeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EmployeRepository::class)]
class Employe extends User
{
#[ORM\JoinColumn(nullable: true)]
#[ORM\ManyToOne(targetEntity: PersonalInformations::class, cascade: ['all'])]
private ?PersonalInformations $personalInformations = null;
#[ORM\OneToMany(mappedBy: 'reorienter', targetEntity: Dossier::class)]
private Collection $dossierReorienters;
#[ORM\OneToMany(mappedBy: 'referentPedagogique', targetEntity: Dossier::class)]
private Collection $referentPedagogiques;
#[ORM\OneToMany(mappedBy: 'referentCommercial', targetEntity: Dossier::class)]
private Collection $referentCommercials;
#[ORM\OneToMany(mappedBy: 'referentCoach', targetEntity: Dossier::class)]
private Collection $referentCoachs;
#[ORM\OneToMany(mappedBy: 'referentAdministratif', targetEntity: Dossier::class)]
private Collection $referentAdministratifs;
#[ORM\OneToMany(mappedBy: 'employe', targetEntity: HistoriqueEmail::class, cascade: ['persist'])]
private Collection $historiqueEmails;
public function __construct()
{
$this->dossierReorienters = new ArrayCollection();
$this->referentPedagogiques = new ArrayCollection();
$this->referentCommercials = new ArrayCollection();
$this->referentCoachs = new ArrayCollection();
$this->referentAdministratifs = new ArrayCollection();
$this->historiqueEmails = new ArrayCollection();
}
public function getPersonalInformations(): ?PersonalInformations
{
return $this->personalInformations;
}
public function setPersonalInformations(?PersonalInformations $personalInformations): self
{
$this->personalInformations = $personalInformations;
return $this;
}
/**
* @return Collection<int, HistoriqueDossier>
*/
public function getDossierReorienters(): Collection
{
return $this->dossierReorienters;
}
public function addDossierReorienter(Dossier $dossier): self
{
if (!$this->dossierReorienters->contains($dossier)) {
$this->dossierReorienters->add($dossier);
$dossier->setReorienter($this);
}
return $this;
}
public function removeDossierReorienter(Dossier $dossier): self
{
// set the owning side to null (unless already changed)
if ($this->dossierReorienters->removeElement($dossier) && $dossier->getReorienter() === $this) {
$dossier->setReorienter(null);
}
return $this;
}
/**
* @return Collection<int, Dossier>
*/
public function getReferentPedagogiques(): Collection
{
return $this->referentPedagogiques;
}
public function addReferentPedagogique(Dossier $referentPedagogique): self
{
if (!$this->referentPedagogiques->contains($referentPedagogique)) {
$this->referentPedagogiques->add($referentPedagogique);
$referentPedagogique->setReferentPedagogique($this);
}
return $this;
}
public function removeReferentPedagogique(Dossier $referentPedagogique): self
{
// set the owning side to null (unless already changed)
if ($this->referentPedagogiques->removeElement($referentPedagogique) && $referentPedagogique->getReferentPedagogique() === $this) {
$referentPedagogique->setReferentPedagogique(null);
}
return $this;
}
/**
* @return Collection<int, Dossier>
*/
public function getReferentCommercials(): Collection
{
return $this->referentCommercials;
}
public function addReferentCommercial(Dossier $referentCommercial): self
{
if (!$this->referentCommercials->contains($referentCommercial)) {
$this->referentCommercials->add($referentCommercial);
$referentCommercial->setReferentCommercial($this);
}
return $this;
}
public function removeReferentCommercial(Dossier $referentCommercial): self
{
// set the owning side to null (unless already changed)
if ($this->referentCommercials->removeElement($referentCommercial) && $referentCommercial->getReferentCommercial() === $this) {
$referentCommercial->setReferentCommercial(null);
}
return $this;
}
/**
* @return Collection<int, Dossier>
*/
public function getReferentCoachs(): Collection
{
return $this->referentCoachs;
}
public function addReferentCoach(Dossier $referentCoach): self
{
if (!$this->referentCoachs->contains($referentCoach)) {
$this->referentCoachs->add($referentCoach);
$referentCoach->setReferentCoach($this);
}
return $this;
}
public function removeReferentCoach(Dossier $referentCoach): self
{
// set the owning side to null (unless already changed)
if ($this->referentCoachs->removeElement($referentCoach) && $referentCoach->getReferentCoach() === $this) {
$referentCoach->setReferentCoach(null);
}
return $this;
}
/**
* @return Collection<int, Dossier>
*/
public function getReferentAdministratifs(): Collection
{
return $this->referentAdministratifs;
}
public function addReferentAdministratif(Dossier $referentAdministratif): self
{
if (!$this->referentAdministratifs->contains($referentAdministratif)) {
$this->referentAdministratifs->add($referentAdministratif);
$referentAdministratif->setReferentAdministratif($this);
}
return $this;
}
public function removeReferentAdministratif(Dossier $referentAdministratif): self
{
// set the owning side to null (unless already changed)
if ($this->referentAdministratifs->removeElement($referentAdministratif) && $referentAdministratif->getReferentAdministratif() === $this) {
$referentAdministratif->setReferentAdministratif(null);
}
return $this;
}
/**
* Convertit l'objet en chaîne de caractères
*
* @return string
*/
public function __toString(): string
{
if ($this->getPersonalInformations() && $this->getPersonalInformations()->getNom()) {
return $this->getPersonalInformations()->getNom() . ' ' . $this->getPersonalInformations()->getPrenom();
}
return $this->getUsername() ?: 'Employé sans nom';
}
/**
* @return Collection<int, HistoriqueEmail>
*/
public function getHistoriqueEmails(): Collection
{
return $this->historiqueEmails;
}
public function addHistoriqueEmail(HistoriqueEmail $historiqueEmail): static
{
if (!$this->historiqueEmails->contains($historiqueEmail)) {
$this->historiqueEmails->add($historiqueEmail);
$historiqueEmail->setEmploye($this);
}
return $this;
}
public function removeHistoriqueEmail(HistoriqueEmail $historiqueEmail): self
{
if ($this->historiqueEmails->removeElement($historiqueEmail)) {
// set the owning side to null (unless already changed)
if ($historiqueEmail->getEmploye() === $this) {
$historiqueEmail->setEmploye(null);
}
}
return $this;
}
}