<?php
namespace App\Entity;
use App\Repository\TierRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=TierRepository::class)
* @Vich\Uploadable
* @UniqueEntity(
* fields={"email"},
* message="Ce mail est déjà utilisé."
* )
* @UniqueEntity(fields={"telephone"},message="Ce téléphone est déjà utilisé." )
*/
class Tier
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $firstname;
/**
* @ORM\Column(type="string", length=255)
*/
private $lastname;
/**
* @ORM\Column(type="string", length=20, nullable=true)
* @Assert\Length(min=6,minMessage = "La taille minimum doit être de {{ limit }} caractères")
*/
private $telephone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\Email(message = "L'email '{{ value }}' n'est pas valide.")
*/
private $email;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $address;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $dateNaissance;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $country;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $city;
/**
* @ORM\OneToMany(targetEntity=Inscrit::class, mappedBy="tier")
*/
private $inscrits;
/**
* @Doctrine\ORM\Mapping\Column(type="string", length=255, nullable=true)
*/
private $image;
/**
* @Vich\UploadableField(mapping="photo_tier", fileNameProperty="image")
*/
private $fichier;
/**
* @ORM\OneToMany(targetEntity=Demande::class, mappedBy="tier")
*/
private $demandes;
//ALTER TABLE `tier` CHANGE `sexe` `sexe` VARCHAR(1) NOT NULL DEFAULT 'g';
//ALTER TABLE tier ADD CONSTRAINT CHK_SEXE1A2EAB469AE CHECK((sexe='g') OR (sexe='f'));
//ALTER TABLE tier DROP CONSTRAINT CHK_SEXE1A2EAB469AE;
//ALTER TABLE `tier` ADD `createdd_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;
/**
* @ORM\Column(type="string", length=1, nullable=true)
*/
private $sexe;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $numerosecuritesociale;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $niveauscolaire;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $diplomesobtenus;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cartepro;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $numeroDiplome;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $dateDiplome;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $updatedAt;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cni;
/**
* @ORM\OneToMany(targetEntity=DemandeDevisEntete::class, mappedBy="tier")
*/
private $demandeDevisEntetes;
/**
* @ORM\OneToMany(targetEntity=TierJustif::class, mappedBy="tier", cascade={"persist", "remove"})
*/
private $tierJustifs;
/**
* @ORM\OneToMany(targetEntity=EvaluationTestb1::class, mappedBy="tier")
*/
private $evaluationTestb1s;
/**
* @ORM\OneToMany(targetEntity=ReponsePersonne::class, mappedBy="tier")
*/
private $reponsePersonnes;
/**
* @ORM\OneToMany(targetEntity=TestB1::class, mappedBy="tier")
*/
private $testB1s;
/**
* @ORM\OneToMany(targetEntity=DemandeByCanal::class, mappedBy="utilisateur")
*/
private $demandeByCanals;
/**
* @ORM\OneToMany(targetEntity=ReglementParticulier::class, mappedBy="tier")
*/
private $reglementParticuliers;
/**
* @ORM\OneToMany(targetEntity=EcheanceParticulier::class, mappedBy="tier")
*/
private $echeanceParticuliers;
public function __toString()
{
return $this->id;
}
public function __construct()
{
$this->inscrits = new ArrayCollection();
$this->demandes = new ArrayCollection();
$this->demandeDevisEntetes = new ArrayCollection();
$this->tierJustifs = new ArrayCollection();
$this->evaluationTestb1s = new ArrayCollection();
$this->reponsePersonnes = new ArrayCollection();
$this->testB1s = new ArrayCollection();
$this->demandeByCanals = new ArrayCollection();
$this->reglementParticuliers = new ArrayCollection();
$this->echeanceParticuliers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function setFirstname(string $firstname): self
{
$this->firstname = $firstname;
return $this;
}
public function getLastname(): ?string
{
return $this->lastname;
}
public function setLastname(string $lastname): self
{
$this->lastname = $lastname;
return $this;
}
public function getTelephone(): ?string
{
return $this->telephone;
}
public function setTelephone(?string $telephone): self
{
$this->telephone = $telephone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getDateNaissance(): ?\DateTimeInterface
{
return $this->dateNaissance;
}
public function setDateNaissance(?\DateTimeInterface $dateNaissance): self
{
$this->dateNaissance = $dateNaissance;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(?string $country): self
{
$this->country = $country;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
/**
* @return Collection<int, Inscrit>
*/
public function getInscrits(): Collection
{
return $this->inscrits;
}
public function addInscrit(Inscrit $inscrit): self
{
if (!$this->inscrits->contains($inscrit)) {
$this->inscrits[] = $inscrit;
$inscrit->setTier($this);
}
return $this;
}
public function removeInscrit(Inscrit $inscrit): self
{
if ($this->inscrits->removeElement($inscrit)) {
// set the owning side to null (unless already changed)
if ($inscrit->getTier() === $this) {
$inscrit->setTier(null);
}
}
return $this;
}
public function setFichier(?File $image = null)
{
$this->fichier = $image;
if ($image) {
$this->updatedAt = new \DateTime('now');
}
}
public function getFichier()
{
return $this->fichier;
}
public function setImage($image)
{
$this->image = $image;
}
public function getImage()
{
return $this->image;
}
/**
* @return Collection<int, Demande>
*/
public function getDemandes(): Collection
{
return $this->demandes;
}
public function addDemande(Demande $demande): self
{
if (!$this->demandes->contains($demande)) {
$this->demandes[] = $demande;
$demande->setTier($this);
}
return $this;
}
public function removeDemande(Demande $demande): self
{
if ($this->demandes->removeElement($demande)) {
// set the owning side to null (unless already changed)
if ($demande->getTier() === $this) {
$demande->setTier(null);
}
}
return $this;
}
public function getSexe(): ?string
{
return $this->sexe;
}
public function setSexe(?string $sexe): self
{
$this->sexe = $sexe;
return $this;
}
public function getNumerosecuritesociale(): ?string
{
return $this->numerosecuritesociale;
}
public function setNumerosecuritesociale(?string $numerosecuritesociale): self
{
$this->numerosecuritesociale = $numerosecuritesociale;
return $this;
}
public function getNiveauscolaire(): ?string
{
return $this->niveauscolaire;
}
public function setNiveauscolaire(?string $niveauscolaire): self
{
$this->niveauscolaire = $niveauscolaire;
return $this;
}
public function getDiplomesobtenus(): ?string
{
return $this->diplomesobtenus;
}
public function setDiplomesobtenus(?string $diplomesobtenus): self
{
$this->diplomesobtenus = $diplomesobtenus;
return $this;
}
public function getCartepro(): ?string
{
return $this->cartepro;
}
public function setCartepro(?string $cartepro): self
{
$this->cartepro = $cartepro;
return $this;
}
public function getNumeroDiplome(): ?string
{
return $this->numeroDiplome;
}
public function setNumeroDiplome(?string $numerodiplome): self
{
$this->numeroDiplome = $numerodiplome;
return $this;
}
public function getDateDiplome(): ?\DateTimeInterface
{
return $this->dateDiplome;
}
public function setDateDiplome(?\DateTimeInterface $dateDiplome): self
{
$this->dateDiplome = $dateDiplome;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getCni(): ?string
{
return $this->cni;
}
public function setCni(?string $cni): self
{
$this->cni = $cni;
return $this;
}
/**
* @return Collection<int, DemandeDevisEntete>
*/
public function getDemandeDevisEntetes(): Collection
{
return $this->demandeDevisEntetes;
}
public function addDemandeDevisEntete(DemandeDevisEntete $demandeDevisEntete): self
{
if (!$this->demandeDevisEntetes->contains($demandeDevisEntete)) {
$this->demandeDevisEntetes[] = $demandeDevisEntete;
$demandeDevisEntete->setTier($this);
}
return $this;
}
public function removeDemandeDevisEntete(DemandeDevisEntete $demandeDevisEntete): self
{
if ($this->demandeDevisEntetes->removeElement($demandeDevisEntete)) {
// set the owning side to null (unless already changed)
if ($demandeDevisEntete->getTier() === $this) {
$demandeDevisEntete->setTier(null);
}
}
return $this;
}
/**
* @return Collection<int, TierJustif>
*/
public function getTierJustifs(): Collection
{
return $this->tierJustifs;
}
public function addTierJustif(TierJustif $tierJustif): self
{
if (!$this->tierJustifs->contains($tierJustif)) {
$this->tierJustifs[] = $tierJustif;
$tierJustif->setTier($this);
}
return $this;
}
public function removeTierJustif(TierJustif $tierJustif): self
{
if ($this->tierJustifs->removeElement($tierJustif)) {
// set the owning side to null (unless already changed)
if ($tierJustif->getTier() === $this) {
$tierJustif->setTier(null);
}
}
return $this;
}
/**
* @return Collection<int, EvaluationTestb1>
*/
public function getEvaluationTestb1s(): Collection
{
return $this->evaluationTestb1s;
}
public function addEvaluationTestb1(EvaluationTestb1 $evaluationTestb1): self
{
if (!$this->evaluationTestb1s->contains($evaluationTestb1)) {
$this->evaluationTestb1s[] = $evaluationTestb1;
$evaluationTestb1->setTier($this);
}
return $this;
}
public function removeEvaluationTestb1(EvaluationTestb1 $evaluationTestb1): self
{
if ($this->evaluationTestb1s->removeElement($evaluationTestb1)) {
// set the owning side to null (unless already changed)
if ($evaluationTestb1->getTier() === $this) {
$evaluationTestb1->setTier(null);
}
}
return $this;
}
/**
* @return Collection<int, ReponsePersonne>
*/
public function getReponsePersonnes(): Collection
{
return $this->reponsePersonnes;
}
public function addReponsePersonne(ReponsePersonne $reponsePersonne): self
{
if (!$this->reponsePersonnes->contains($reponsePersonne)) {
$this->reponsePersonnes[] = $reponsePersonne;
$reponsePersonne->setTier($this);
}
return $this;
}
public function removeReponsePersonne(ReponsePersonne $reponsePersonne): self
{
if ($this->reponsePersonnes->removeElement($reponsePersonne)) {
// set the owning side to null (unless already changed)
if ($reponsePersonne->getTier() === $this) {
$reponsePersonne->setTier(null);
}
}
return $this;
}
/**
* @return Collection<int, TestB1>
*/
public function getTestB1s(): Collection
{
return $this->testB1s;
}
public function addTestB1(TestB1 $testB1): self
{
if (!$this->testB1s->contains($testB1)) {
$this->testB1s[] = $testB1;
$testB1->setTier($this);
}
return $this;
}
public function removeTestB1(TestB1 $testB1): self
{
if ($this->testB1s->removeElement($testB1)) {
// set the owning side to null (unless already changed)
if ($testB1->getTier() === $this) {
$testB1->setTier(null);
}
}
return $this;
}
/**
* @return Collection<int, DemandeByCanal>
*/
public function getDemandeByCanals(): Collection
{
return $this->demandeByCanals;
}
public function addDemandeByCanal(DemandeByCanal $demandeByCanal): self
{
if (!$this->demandeByCanals->contains($demandeByCanal)) {
$this->demandeByCanals[] = $demandeByCanal;
$demandeByCanal->setUtilisateur($this);
}
return $this;
}
public function removeDemandeByCanal(DemandeByCanal $demandeByCanal): self
{
if ($this->demandeByCanals->removeElement($demandeByCanal)) {
// set the owning side to null (unless already changed)
if ($demandeByCanal->getUtilisateur() === $this) {
$demandeByCanal->setUtilisateur(null);
}
}
return $this;
}
/**
* @return Collection<int, ReglementParticulier>
*/
public function getReglementParticuliers(): Collection
{
return $this->reglementParticuliers;
}
public function addReglementParticulier(ReglementParticulier $reglementParticulier): self
{
if (!$this->reglementParticuliers->contains($reglementParticulier)) {
$this->reglementParticuliers[] = $reglementParticulier;
$reglementParticulier->setTier($this);
}
return $this;
}
public function removeReglementParticulier(ReglementParticulier $reglementParticulier): self
{
if ($this->reglementParticuliers->removeElement($reglementParticulier)) {
// set the owning side to null (unless already changed)
if ($reglementParticulier->getTier() === $this) {
$reglementParticulier->setTier(null);
}
}
return $this;
}
/**
* @return Collection<int, EcheanceParticulier>
*/
public function getEcheanceParticuliers(): Collection
{
return $this->echeanceParticuliers;
}
public function addEcheanceParticulier(EcheanceParticulier $echeanceParticulier): self
{
if (!$this->echeanceParticuliers->contains($echeanceParticulier)) {
$this->echeanceParticuliers[] = $echeanceParticulier;
$echeanceParticulier->setTier($this);
}
return $this;
}
public function removeEcheanceParticulier(EcheanceParticulier $echeanceParticulier): self
{
if ($this->echeanceParticuliers->removeElement($echeanceParticulier)) {
// set the owning side to null (unless already changed)
if ($echeanceParticulier->getTier() === $this) {
$echeanceParticulier->setTier(null);
}
}
return $this;
}
}