src/Entity/Tier.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TierRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. /**
  12.  * @ORM\Entity(repositoryClass=TierRepository::class)
  13.  * @Vich\Uploadable
  14.  * @UniqueEntity(
  15.  *      fields={"email"},
  16.  *      message="Ce mail est déjà utilisé."
  17.  * )
  18.  * @UniqueEntity(fields={"telephone"},message="Ce téléphone est déjà utilisé." )
  19.  */
  20. class Tier
  21. {
  22.     /**
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue
  25.      * @ORM\Column(type="integer")
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\Column(type="string", length=255)
  30.      */
  31.     private $firstname;
  32.     /**
  33.      * @ORM\Column(type="string", length=255)
  34.      */
  35.     private $lastname;
  36.     /**
  37.      * @ORM\Column(type="string", length=20, nullable=true)
  38.      * @Assert\Length(min=6,minMessage = "La taille minimum doit être de {{ limit }} caractères")
  39.      */
  40.     private $telephone;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      * @Assert\Email(message = "L'email '{{ value }}' n'est pas valide.")
  44.      */
  45.     private $email;
  46.     /**
  47.      * @ORM\Column(type="text", nullable=true)
  48.      */
  49.     private $address;
  50.     /**
  51.      * @ORM\Column(type="date", nullable=true)
  52.      */
  53.     private $dateNaissance;
  54.     /**
  55.      * @ORM\Column(type="string", length=255, nullable=true)
  56.      */
  57.     private $country;
  58.     /**
  59.      * @ORM\Column(type="string", length=255, nullable=true)
  60.      */
  61.     private $city;
  62.     /**
  63.      * @ORM\OneToMany(targetEntity=Inscrit::class, mappedBy="tier")
  64.      */
  65.     private $inscrits;
  66.     /**
  67.      * @Doctrine\ORM\Mapping\Column(type="string", length=255, nullable=true)
  68.      */
  69.     private $image;
  70.     /**
  71.      * @Vich\UploadableField(mapping="photo_tier", fileNameProperty="image")
  72.      */
  73.     private $fichier;
  74.     /**
  75.      * @ORM\OneToMany(targetEntity=Demande::class, mappedBy="tier")
  76.      */
  77.     private $demandes;
  78.     //ALTER TABLE `tier` CHANGE `sexe` `sexe` VARCHAR(1) NOT NULL DEFAULT 'g';
  79.     //ALTER TABLE tier ADD CONSTRAINT CHK_SEXE1A2EAB469AE CHECK((sexe='g') OR (sexe='f'));
  80.     //ALTER TABLE tier DROP CONSTRAINT CHK_SEXE1A2EAB469AE;
  81.     //ALTER TABLE `tier` ADD `createdd_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;
  82.     /**
  83.      * @ORM\Column(type="string", length=1, nullable=true)
  84.      */
  85.     private $sexe;
  86.     /**
  87.      * @ORM\Column(type="string", length=255, nullable=true)
  88.      */
  89.     private $numerosecuritesociale;
  90.     /**
  91.      * @ORM\Column(type="string", length=255, nullable=true)
  92.      */
  93.     private $niveauscolaire;
  94.     /**
  95.      * @ORM\Column(type="string", length=255, nullable=true)
  96.      */
  97.     private $diplomesobtenus;
  98.     /**
  99.      * @ORM\Column(type="string", length=255, nullable=true)
  100.      */
  101.     private $cartepro;
  102.     /**
  103.      * @ORM\Column(type="string", length=255, nullable=true)
  104.      */
  105.     private $numeroDiplome;
  106.      /**
  107.      * @ORM\Column(type="date", nullable=true)
  108.      */
  109.     private $dateDiplome;
  110.     /**
  111.      * @ORM\Column(type="date", nullable=true)
  112.      */
  113.     private $updatedAt;
  114.     /**
  115.      * @ORM\Column(type="string", length=255, nullable=true)
  116.      */
  117.     private $cni;
  118.     /**
  119.      * @ORM\OneToMany(targetEntity=DemandeDevisEntete::class, mappedBy="tier")
  120.      */
  121.     private $demandeDevisEntetes
  122.     /**
  123.      * @ORM\OneToMany(targetEntity=TierJustif::class, mappedBy="tier", cascade={"persist", "remove"})
  124.      */
  125.     private $tierJustifs;
  126.     /**
  127.      * @ORM\OneToMany(targetEntity=EvaluationTestb1::class, mappedBy="tier")
  128.      */
  129.     private $evaluationTestb1s;
  130.     /**
  131.      * @ORM\OneToMany(targetEntity=ReponsePersonne::class, mappedBy="tier")
  132.      */
  133.     private $reponsePersonnes;
  134.     /**
  135.      * @ORM\OneToMany(targetEntity=TestB1::class, mappedBy="tier")
  136.      */
  137.     private $testB1s;
  138.     /**
  139.      * @ORM\OneToMany(targetEntity=DemandeByCanal::class, mappedBy="utilisateur")
  140.      */
  141.     private $demandeByCanals;
  142.     /**
  143.      * @ORM\OneToMany(targetEntity=ReglementParticulier::class, mappedBy="tier")
  144.      */
  145.     private $reglementParticuliers;
  146.     /**
  147.      * @ORM\OneToMany(targetEntity=EcheanceParticulier::class, mappedBy="tier")
  148.      */
  149.     private $echeanceParticuliers;
  150.     
  151.     public function __toString()
  152.     {
  153.         return $this->id
  154.     }
  155.     public function __construct()
  156.     {
  157.         $this->inscrits = new ArrayCollection();
  158.         $this->demandes = new ArrayCollection();
  159.         $this->demandeDevisEntetes = new ArrayCollection(); 
  160.         $this->tierJustifs = new ArrayCollection();
  161.         $this->evaluationTestb1s = new ArrayCollection();
  162.         $this->reponsePersonnes = new ArrayCollection();
  163.         $this->testB1s = new ArrayCollection();
  164.         $this->demandeByCanals = new ArrayCollection();
  165.         $this->reglementParticuliers = new ArrayCollection();
  166.         $this->echeanceParticuliers = new ArrayCollection();
  167.     }
  168.     public function getId(): ?int
  169.     {
  170.         return $this->id;
  171.     }
  172.     public function getFirstname(): ?string
  173.     {
  174.         return $this->firstname;
  175.     }
  176.     public function setFirstname(string $firstname): self
  177.     {
  178.         $this->firstname $firstname;
  179.         return $this;
  180.     }
  181.     public function getLastname(): ?string
  182.     {
  183.         return $this->lastname;
  184.     }
  185.     public function setLastname(string $lastname): self
  186.     {
  187.         $this->lastname $lastname;
  188.         return $this;
  189.     }
  190.     public function getTelephone(): ?string
  191.     {
  192.         return $this->telephone;
  193.     }
  194.     public function setTelephone(?string $telephone): self
  195.     {
  196.         $this->telephone $telephone;
  197.         return $this;
  198.     }
  199.     public function getEmail(): ?string
  200.     {
  201.         return $this->email;
  202.     }
  203.     public function setEmail(?string $email): self
  204.     {
  205.         $this->email $email;
  206.         return $this;
  207.     }
  208.     public function getAddress(): ?string
  209.     {
  210.         return $this->address;
  211.     }
  212.     public function setAddress(?string $address): self
  213.     {
  214.         $this->address $address;
  215.         return $this;
  216.     }
  217.     public function getDateNaissance(): ?\DateTimeInterface
  218.     {
  219.         return $this->dateNaissance;
  220.     }
  221.     public function setDateNaissance(?\DateTimeInterface $dateNaissance): self
  222.     {
  223.         $this->dateNaissance $dateNaissance;
  224.         return $this;
  225.     }
  226.     public function getCountry(): ?string
  227.     {
  228.         return $this->country;
  229.     }
  230.     public function setCountry(?string $country): self
  231.     {
  232.         $this->country $country;
  233.         return $this;
  234.     }
  235.     public function getCity(): ?string
  236.     {
  237.         return $this->city;
  238.     }
  239.     public function setCity(?string $city): self
  240.     {
  241.         $this->city $city;
  242.         return $this;
  243.     }
  244.     /**
  245.      * @return Collection<int, Inscrit>
  246.      */
  247.     public function getInscrits(): Collection
  248.     {
  249.         return $this->inscrits;
  250.     }
  251.     public function addInscrit(Inscrit $inscrit): self
  252.     {
  253.         if (!$this->inscrits->contains($inscrit)) {
  254.             $this->inscrits[] = $inscrit;
  255.             $inscrit->setTier($this);
  256.         }
  257.         return $this;
  258.     }
  259.     public function removeInscrit(Inscrit $inscrit): self
  260.     {
  261.         if ($this->inscrits->removeElement($inscrit)) {
  262.             // set the owning side to null (unless already changed)
  263.             if ($inscrit->getTier() === $this) {
  264.                 $inscrit->setTier(null);
  265.             }
  266.         }
  267.         return $this;
  268.     }
  269.     public function setFichier(?File $image null)
  270.     {
  271.         $this->fichier $image;
  272.         if ($image) {
  273.             $this->updatedAt = new \DateTime('now');
  274.         }
  275.     }
  276.     public function getFichier()
  277.     {
  278.         return $this->fichier;
  279.     }
  280.     public function setImage($image)
  281.     {
  282.         $this->image $image;
  283.     }
  284.     public function getImage()
  285.     {
  286.         return $this->image;
  287.     }
  288.     /**
  289.      * @return Collection<int, Demande>
  290.      */
  291.     public function getDemandes(): Collection
  292.     {
  293.         return $this->demandes;
  294.     }
  295.     public function addDemande(Demande $demande): self
  296.     {
  297.         if (!$this->demandes->contains($demande)) {
  298.             $this->demandes[] = $demande;
  299.             $demande->setTier($this);
  300.         }
  301.         return $this;
  302.     }
  303.     public function removeDemande(Demande $demande): self
  304.     {
  305.         if ($this->demandes->removeElement($demande)) {
  306.             // set the owning side to null (unless already changed)
  307.             if ($demande->getTier() === $this) {
  308.                 $demande->setTier(null);
  309.             }
  310.         }
  311.         return $this;
  312.     }
  313.     public function getSexe(): ?string
  314.     {
  315.         return $this->sexe;
  316.     }
  317.     public function setSexe(?string $sexe): self
  318.     {
  319.         $this->sexe $sexe;
  320.         return $this;
  321.     }
  322.     public function getNumerosecuritesociale(): ?string
  323.     {
  324.         return $this->numerosecuritesociale;
  325.     }
  326.     public function setNumerosecuritesociale(?string $numerosecuritesociale): self
  327.     {
  328.         $this->numerosecuritesociale $numerosecuritesociale;
  329.         return $this;
  330.     }
  331.     public function getNiveauscolaire(): ?string
  332.     {
  333.         return $this->niveauscolaire;
  334.     }
  335.     public function setNiveauscolaire(?string $niveauscolaire): self
  336.     {
  337.         $this->niveauscolaire $niveauscolaire;
  338.         return $this;
  339.     }
  340.     public function getDiplomesobtenus(): ?string
  341.     {
  342.         return $this->diplomesobtenus;
  343.     }
  344.     public function setDiplomesobtenus(?string $diplomesobtenus): self
  345.     {
  346.         $this->diplomesobtenus $diplomesobtenus;
  347.         return $this;
  348.     }
  349.    
  350.     public function getCartepro(): ?string
  351.     {
  352.         return $this->cartepro;
  353.     }
  354.     public function setCartepro(?string $cartepro): self
  355.     {
  356.         $this->cartepro $cartepro;
  357.         return $this;
  358.     }
  359.     public function getNumeroDiplome(): ?string
  360.     {
  361.         return $this->numeroDiplome;
  362.     }
  363.     public function setNumeroDiplome(?string $numerodiplome): self
  364.     {
  365.         $this->numeroDiplome $numerodiplome;
  366.         return $this;
  367.     }
  368.     public function getDateDiplome(): ?\DateTimeInterface
  369.     {
  370.         return $this->dateDiplome;
  371.     }
  372.     public function setDateDiplome(?\DateTimeInterface $dateDiplome): self
  373.     {
  374.         $this->dateDiplome $dateDiplome;
  375.         return $this;
  376.     }
  377.     public function getUpdatedAt(): ?\DateTimeImmutable
  378.     {
  379.         return $this->updatedAt;
  380.     }
  381.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  382.     {
  383.         $this->updatedAt $updatedAt;
  384.         return $this;
  385.     }
  386.     public function getCni(): ?string
  387.     {
  388.         return $this->cni;
  389.     }
  390.     public function setCni(?string $cni): self
  391.     {
  392.         $this->cni $cni;
  393.         return $this;
  394.     }
  395.     /**
  396.      * @return Collection<int, DemandeDevisEntete>
  397.      */
  398.     public function getDemandeDevisEntetes(): Collection
  399.     {
  400.         return $this->demandeDevisEntetes;
  401.     }
  402.     public function addDemandeDevisEntete(DemandeDevisEntete $demandeDevisEntete): self
  403.     {
  404.         if (!$this->demandeDevisEntetes->contains($demandeDevisEntete)) {
  405.             $this->demandeDevisEntetes[] = $demandeDevisEntete;
  406.             $demandeDevisEntete->setTier($this);
  407.         }
  408.         return $this;
  409.     }
  410.     public function removeDemandeDevisEntete(DemandeDevisEntete $demandeDevisEntete): self
  411.     {
  412.         if ($this->demandeDevisEntetes->removeElement($demandeDevisEntete)) {
  413.             // set the owning side to null (unless already changed)
  414.             if ($demandeDevisEntete->getTier() === $this) {
  415.                 $demandeDevisEntete->setTier(null);
  416.             }
  417.         }
  418.         return $this;
  419.     } 
  420.    
  421.     /**
  422.      * @return Collection<int, TierJustif>
  423.      */
  424.     public function getTierJustifs(): Collection
  425.     {
  426.         return $this->tierJustifs;
  427.     }
  428.     public function addTierJustif(TierJustif $tierJustif): self
  429.     {
  430.         if (!$this->tierJustifs->contains($tierJustif)) {
  431.             $this->tierJustifs[] = $tierJustif;
  432.             $tierJustif->setTier($this);
  433.         }
  434.         return $this;
  435.     }
  436.     public function removeTierJustif(TierJustif $tierJustif): self
  437.     {
  438.         if ($this->tierJustifs->removeElement($tierJustif)) {
  439.             // set the owning side to null (unless already changed)
  440.             if ($tierJustif->getTier() === $this) {
  441.                 $tierJustif->setTier(null);
  442.             }
  443.         }
  444.         return $this;
  445.     }
  446.     /**
  447.      * @return Collection<int, EvaluationTestb1>
  448.      */
  449.     public function getEvaluationTestb1s(): Collection
  450.     {
  451.         return $this->evaluationTestb1s;
  452.     }
  453.     public function addEvaluationTestb1(EvaluationTestb1 $evaluationTestb1): self
  454.     {
  455.         if (!$this->evaluationTestb1s->contains($evaluationTestb1)) {
  456.             $this->evaluationTestb1s[] = $evaluationTestb1;
  457.             $evaluationTestb1->setTier($this);
  458.         }
  459.         return $this;
  460.     }
  461.     public function removeEvaluationTestb1(EvaluationTestb1 $evaluationTestb1): self
  462.     {
  463.         if ($this->evaluationTestb1s->removeElement($evaluationTestb1)) {
  464.             // set the owning side to null (unless already changed)
  465.             if ($evaluationTestb1->getTier() === $this) {
  466.                 $evaluationTestb1->setTier(null);
  467.             }
  468.         }
  469.         return $this;
  470.     }
  471.     /**
  472.      * @return Collection<int, ReponsePersonne>
  473.      */
  474.     public function getReponsePersonnes(): Collection
  475.     {
  476.         return $this->reponsePersonnes;
  477.     }
  478.     public function addReponsePersonne(ReponsePersonne $reponsePersonne): self
  479.     {
  480.         if (!$this->reponsePersonnes->contains($reponsePersonne)) {
  481.             $this->reponsePersonnes[] = $reponsePersonne;
  482.             $reponsePersonne->setTier($this);
  483.         }
  484.         return $this;
  485.     }
  486.     public function removeReponsePersonne(ReponsePersonne $reponsePersonne): self
  487.     {
  488.         if ($this->reponsePersonnes->removeElement($reponsePersonne)) {
  489.             // set the owning side to null (unless already changed)
  490.             if ($reponsePersonne->getTier() === $this) {
  491.                 $reponsePersonne->setTier(null);
  492.             }
  493.         }
  494.         return $this;
  495.     }
  496.     /**
  497.      * @return Collection<int, TestB1>
  498.      */
  499.     public function getTestB1s(): Collection
  500.     {
  501.         return $this->testB1s;
  502.     }
  503.     public function addTestB1(TestB1 $testB1): self
  504.     {
  505.         if (!$this->testB1s->contains($testB1)) {
  506.             $this->testB1s[] = $testB1;
  507.             $testB1->setTier($this);
  508.         }
  509.         return $this;
  510.     }
  511.     public function removeTestB1(TestB1 $testB1): self
  512.     {
  513.         if ($this->testB1s->removeElement($testB1)) {
  514.             // set the owning side to null (unless already changed)
  515.             if ($testB1->getTier() === $this) {
  516.                 $testB1->setTier(null);
  517.             }
  518.         }
  519.         return $this;
  520.     }
  521.     /**
  522.      * @return Collection<int, DemandeByCanal>
  523.      */
  524.     public function getDemandeByCanals(): Collection
  525.     {
  526.         return $this->demandeByCanals;
  527.     }
  528.     public function addDemandeByCanal(DemandeByCanal $demandeByCanal): self
  529.     {
  530.         if (!$this->demandeByCanals->contains($demandeByCanal)) {
  531.             $this->demandeByCanals[] = $demandeByCanal;
  532.             $demandeByCanal->setUtilisateur($this);
  533.         }
  534.         return $this;
  535.     }
  536.     public function removeDemandeByCanal(DemandeByCanal $demandeByCanal): self
  537.     {
  538.         if ($this->demandeByCanals->removeElement($demandeByCanal)) {
  539.             // set the owning side to null (unless already changed)
  540.             if ($demandeByCanal->getUtilisateur() === $this) {
  541.                 $demandeByCanal->setUtilisateur(null);
  542.             }
  543.         }
  544.         return $this;
  545.     }
  546.     /**
  547.      * @return Collection<int, ReglementParticulier>
  548.      */
  549.     public function getReglementParticuliers(): Collection
  550.     {
  551.         return $this->reglementParticuliers;
  552.     }
  553.     public function addReglementParticulier(ReglementParticulier $reglementParticulier): self
  554.     {
  555.         if (!$this->reglementParticuliers->contains($reglementParticulier)) {
  556.             $this->reglementParticuliers[] = $reglementParticulier;
  557.             $reglementParticulier->setTier($this);
  558.         }
  559.         return $this;
  560.     }
  561.     public function removeReglementParticulier(ReglementParticulier $reglementParticulier): self
  562.     {
  563.         if ($this->reglementParticuliers->removeElement($reglementParticulier)) {
  564.             // set the owning side to null (unless already changed)
  565.             if ($reglementParticulier->getTier() === $this) {
  566.                 $reglementParticulier->setTier(null);
  567.             }
  568.         }
  569.         return $this;
  570.     }
  571.     /**
  572.      * @return Collection<int, EcheanceParticulier>
  573.      */
  574.     public function getEcheanceParticuliers(): Collection
  575.     {
  576.         return $this->echeanceParticuliers;
  577.     }
  578.     public function addEcheanceParticulier(EcheanceParticulier $echeanceParticulier): self
  579.     {
  580.         if (!$this->echeanceParticuliers->contains($echeanceParticulier)) {
  581.             $this->echeanceParticuliers[] = $echeanceParticulier;
  582.             $echeanceParticulier->setTier($this);
  583.         }
  584.         return $this;
  585.     }
  586.     public function removeEcheanceParticulier(EcheanceParticulier $echeanceParticulier): self
  587.     {
  588.         if ($this->echeanceParticuliers->removeElement($echeanceParticulier)) {
  589.             // set the owning side to null (unless already changed)
  590.             if ($echeanceParticulier->getTier() === $this) {
  591.                 $echeanceParticulier->setTier(null);
  592.             }
  593.         }
  594.         return $this;
  595.     }
  596.   
  597. }