src/Entity/InscriptionSessionFormation.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\InscriptionSessionFormationRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassInscriptionSessionFormationRepository::class)]
  7. class InscriptionSessionFormation
  8. {
  9.     public const STATUS_ARRAY = [
  10.         'WAITING' => 'en cours',
  11.         'VALIDATED' => 'validée',
  12.         'REFUSED' => 'proposition',
  13.     ];
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $fonction null;
  20.     #[ORM\ManyToOne(inversedBy'inscriptionSessionFormations')]
  21.     private ?User $user null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $tel null;
  24.     #[ORM\Column(length255)]
  25.     private ?string $mail null;
  26.     #[ORM\ManyToOne(inversedBy'inscriptionSessionFormations'cascade: ['persist'])]
  27.     private ?Sessionsformation $sessionFormation null;
  28.     #[ORM\Column(type'string'nullable:falseoptions:[ 'default' => self::STATUS_ARRAY['WAITING'] ])]
  29.     private $status self::STATUS_ARRAY['WAITING'] ;
  30.     #[ORM\Column(typeTypes::TEXTnullable:true)]
  31.     private ?string $motif null;
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getFonction(): ?string
  37.     {
  38.         return $this->fonction;
  39.     }
  40.     public function setFonction(string $fonction): self
  41.     {
  42.         $this->fonction $fonction;
  43.         return $this;
  44.     }
  45.     public function getUser(): ?User
  46.     {
  47.         return $this->user;
  48.     }
  49.     public function setUser(?User $user): self
  50.     {
  51.         $this->user $user;
  52.         return $this;
  53.     }
  54.     public function getTel(): ?string
  55.     {
  56.         return $this->tel;
  57.     }
  58.     public function setTel(string $tel): self
  59.     {
  60.         $this->tel $tel;
  61.         return $this;
  62.     }
  63.     public function getStatus()
  64.     {
  65.         return $this->status;
  66.     }
  67.     public function setStatus($status): self
  68.     {
  69.         $current_status strtolower(array_search($this->statusself::STATUS_ARRAY));
  70.         if ($status) {
  71.             $this->status self::STATUS_ARRAYstrtoupper($status) ];
  72.         } else {
  73.             $this->status self::STATUS_ARRAYstrtoupper($current_status) ] ;
  74.         }
  75.         return $this;
  76.     }
  77.     public function getMail(): ?string
  78.     {
  79.         return $this->mail;
  80.     }
  81.     public function setMail(string $mail): self
  82.     {
  83.         $this->mail $mail;
  84.         return $this;
  85.     }
  86.     public function getSessionFormation(): ?Sessionsformation
  87.     {
  88.         return $this->sessionFormation;
  89.     }
  90.     public function setSessionFormation(?Sessionsformation $sessionFormation): self
  91.     {
  92.         $this->sessionFormation $sessionFormation;
  93.         return $this;
  94.     }
  95.     public function getMotif(): ?string
  96.     {
  97.         return $this->motif;
  98.     }
  99.     public function setMotif(string $motif): self
  100.     {
  101.         $this->motif $motif;
  102.         return $this;
  103.     }
  104.     public function getExportData()
  105.     {
  106.         return \array_merge([
  107.             'Session' => $this->getSessionFormation()->getTitre(),
  108.             'Utilisateur' => $this->getUser()->getUsername(),
  109.             'Fonction' => $this->getFonction(),
  110.             'E-mail' => $this->getMail() ?? '',
  111.             'Teléphone' => $this->getTel(),
  112.             'statut' => $this->getStatus() ?? '',
  113.             'Proposition' => $this->getMotif() ?? ''
  114.         ]);
  115.     }
  116. }