<?php
declare(strict_types=1);
/*
* Copyright (C) Office National de Publication et de Communication - All Rights Reserved
*
* Unauthorized copying of this file, via any medium is strictly prohibited by law
* This file is proprietary and confidential
*/
namespace App\Entity;
use App\Entity\Common\AdresseTrait;
use App\Entity\Common\IdTrait;
use App\Validator\Constraints as AppAssert;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\OffreEmploiCandidatureRepository")
* @ORM\Table(name="offre_emploi_candidature")
*/
class OffreEmploiCandidature
{
use AdresseTrait;
use IdTrait;
/** @ORM\Column(type="datetime", nullable=false) */
private $dateCreation;
/** @ORM\Column(type="string", nullable=true) */
private $libelle;
/** @ORM\Column(type="string", nullable=false) */
private $civilite;
/** @ORM\Column(type="string", nullable=false) */
private $nom;
/** @ORM\Column(type="string", nullable=true) */
private $prenom;
/** @ORM\Column(type="string", nullable=true) */
private $adresse;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\Regex("/^\d{5}$/")
*/
private $codePostal;
/** @ORM\Column(type="string", nullable=true) */
private $ville;
/** @ORM\Column(type="string", nullable=true) */
private $telephone;
/**
* @ORM\Column(type="string", length=150, nullable=false)
* @Assert\Email
*/
private $email;
/**
* @ORM\Column(type="text", nullable=true)
* @AppAssert\DoesNotContainsLink
*/
private $commentaire;
/**
* @ORM\ManyToOne(targetEntity="Etablissement")
* @ORM\JoinColumn(name="etablissement_id", referencedColumnName="id", nullable=false)
*/
private $etablissement;
/**
* @ORM\ManyToOne(targetEntity="OffreEmploi", inversedBy="candidatures")
* @ORM\JoinColumn(name="offre_emploi_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/
private $offreEmploi;
/**
* @Assert\NotBlank
* @Assert\File(
* mimeTypes={
* "application/pdf",
* "application/msword",
* "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
* },
* mimeTypesMessage="Le type du fichier est invalide, Les types autorisées sont pdf, doc et docx"
* )
*/
private $resume;
public function __construct()
{
$this->dateCreation = new DateTime();
}
public function getDateCreation(): DateTime
{
return $this->dateCreation;
}
public function setLibelle(?string $libelle): void
{
$this->libelle = $libelle;
}
public function getLibelle(): ?string
{
$offre = $this->getOffreEmploi();
return $offre ? $offre->getLibelle() : $this->libelle;
}
public function setCivilite(?string $civilite): void
{
$this->civilite = $civilite;
}
public function getCivilite(): ?string
{
return $this->civilite;
}
public function setNom(?string $nom): void
{
$this->nom = $nom;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setPrenom(?string $prenom): void
{
$this->prenom = $prenom;
}
public function getPrenom(): ?string
{
return $this->prenom;
}
public function setTelephone(?string $telephone): void
{
$this->telephone = $telephone;
}
public function getTelephone(): ?string
{
return $this->telephone;
}
public function setEmail(?string $email): void
{
$this->email = $email;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setCommentaire(?string $commentaire): void
{
$this->commentaire = $commentaire;
}
public function getCommentaire(): ?string
{
return $this->commentaire;
}
public function setOffreEmploi(OffreEmploi $offreEmploi): void
{
$this->offreEmploi = $offreEmploi;
$this->libelle = $offreEmploi->getLibelle();
$this->etablissement = $offreEmploi->getEtablissement();
}
public function getOffreEmploi(): ?OffreEmploi
{
return $this->offreEmploi;
}
public function setEtablissement(Etablissement $etablissement): void
{
$this->etablissement = $etablissement;
$this->offreEmploi = null;
}
public function getEtablissement(): ?Etablissement
{
return $this->etablissement;
}
public function setResume(UploadedFile $resume): void
{
$this->resume = $resume;
}
public function getResume(): ?UploadedFile
{
return $this->resume;
}
}