src/Entity/Client.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  5. use Symfony\Component\Security\Core\User\UserInterface;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\ClientRepository")
  10.  * @ORM\Table(name="clients")
  11.  * @method string getUserIdentifier()
  12.  */
  13. class Client implements UserInterfacePasswordAuthenticatedUserInterface
  14. {
  15.     const RESOURCE_KEY 'clients';
  16.     public function __construct()
  17.     {
  18.         $this->transactions = new ArrayCollection();
  19.         $this->abonnement null;
  20.         $this->cr_sdr 0;
  21.         $this->cr_mijourne 0;
  22.         $this->cr_journe 0;
  23.         $this->cr_mois 0;
  24.     }
  25.     /**
  26.      * @ORM\Id
  27.      * @ORM\GeneratedValue
  28.      * @ORM\Column(type="integer")
  29.      */
  30.     private $id;
  31.     /**
  32.      * @ORM\Column(type="string", length=100)
  33.      */
  34.     public $nom;
  35.     /**
  36.      * @ORM\Column(type="string", length=100)
  37.      */
  38.     public $prenom;
  39.     /**
  40.      * @ORM\Column(type="string", length=100)
  41.      */
  42.     public $civ;
  43.     /**
  44.      * @ORM\Column(type="string", length=100)
  45.      */
  46.     public $telephone;
  47.     /**
  48.      * @ORM\Column(type="string", length=100)
  49.      */
  50.     public $adresse1;
  51.     /**
  52.      * @ORM\Column(type="string", length=100)
  53.      */
  54.     public $adresse2;
  55.     /**
  56.      * @ORM\Column(type="string", length=100)
  57.      */
  58.     public $ville;
  59.     /**
  60.      * @ORM\Column(type="string", length=100)
  61.      */
  62.     public $region;
  63.     /**
  64.      * @ORM\Column(type="string", length=100)
  65.      */
  66.     public $cp;
  67.     /**
  68.      * @ORM\Column(type="string", length=100)
  69.      */
  70.     public $pays;
  71.     /**
  72.      * @ORM\Column(type="string", length=100)
  73.      */
  74.     public $raison_social;
  75.     /**
  76.      * @ORM\Column(type="boolean", length=1)
  77.      */
  78.     public $recevoir_offre;
  79.     /**
  80.      * @ORM\Column(type="string", length=180, unique=true)
  81.      */
  82.     private $email;
  83.     
  84.     /**
  85.      * @ORM\Column(type="string", length=255)
  86.      */
  87.     public $password;
  88.     /**
  89.      * @ORM\Column(type="datetime")
  90.      */
  91.     public $created;
  92.     /**
  93.      * @ORM\Column(type="datetime")
  94.      */
  95.     public $changed;
  96.     /**
  97.      * @ORM\Column(type="integer", options={"default": 0})
  98.      */
  99.     public $cr_sdr;
  100.     /**
  101.      * @ORM\Column(type="integer", options={"default": 0})
  102.      */
  103.     public $cr_mijourne;
  104.     /**
  105.      * @ORM\Column(type="integer", options={"default": 0})
  106.      */
  107.     public $cr_journe;
  108.     /**
  109.      * @ORM\Column(type="integer", options={"default": 0})
  110.      */
  111.     public $cr_mois;
  112.     #[ORM\OneToMany(targetEntityTransaction::class, mappedBy'client'cascade: ['persist''remove'])]
  113.     private $transactions;
  114.     /**
  115.      * @ORM\OneToOne(targetEntity=Abonnement::class, mappedBy="client")
  116.      */
  117.     private ?Abonnement $abonnement null;
  118.     /**
  119.      * @ORM\Column(type="string", length=100)
  120.      */
  121.     public $email_facturation;
  122.     /**
  123.      * @ORM\Column(type="string", length=100)
  124.      */
  125.     public $siret;
  126.     /**
  127.      * @ORM\Column(type="integer", options={"default": 0})
  128.      */
  129.     public $tva;
  130.     /**
  131.      * @ORM\Column(type="integer", options={"default": 0})
  132.      */
  133.     public $tva_applicable;
  134.     /**
  135.      * @ORM\Column(type="string", length=100)
  136.      */
  137.     public $rib_etablissement;
  138.     /**
  139.      * @ORM\Column(type="string", length=100)
  140.      */
  141.     public $rib_rice;
  142.     /**
  143.      * @ORM\Column(type="string", length=100)
  144.      */
  145.     public $rib_guichet;
  146.     /**
  147.      * @ORM\Column(type="string", length=100)
  148.      */
  149.     public $rib_iban;
  150.     /**
  151.      * @ORM\Column(type="string", length=100)
  152.      */
  153.     public $rib_compte;
  154.     /**
  155.      * @ORM\Column(type="string", length=100)
  156.      */
  157.     public $rib_bic;
  158.     /**
  159.      * @ORM\Column(type="string", length=100)
  160.      */
  161.     public $domiciliation;
  162.     /**
  163.      * @ORM\Column(type="boolean")
  164.      */
  165.     public $deleted;
  166.     private array $roles = [];
  167.     /**
  168.      * @ORM\Column(type="string", length=255, nullable=true)
  169.      */
  170.     private ?string $resetToken null;
  171.     /**
  172.      * @ORM\Column(type="datetime", nullable=true)
  173.      */
  174.     private ?\DateTimeInterface $resetTokenExpiresAt null;
  175.     public function getFullName(): string
  176.     {
  177.         return $this->prenom ' ' $this->nom;
  178.     }
  179.     // Getter pour "nom"
  180.     public function getNom(): ?string
  181.     {
  182.         return $this->nom;
  183.     }
  184.     // Setter pour "nom"
  185.     public function setNom(string $nom): self
  186.     {
  187.         $this->nom $nom;
  188.         return $this;
  189.     }
  190.     // Getter pour "prenom"
  191.     public function getPrenom(): ?string
  192.     {
  193.         return $this->prenom;
  194.     }
  195.     // Setter pour "prenom"
  196.     public function setPrenom(string $prenom): self
  197.     {
  198.         $this->prenom $prenom;
  199.         return $this;
  200.     }
  201.     public function getCiv(): ?string
  202.     {
  203.         return $this->civ;
  204.     }
  205.     public function setCiv(string $civ): self
  206.     {
  207.         $this->civ $civ;
  208.         return $this;
  209.     }
  210.     public function getCp(): ?string
  211.     {
  212.         return $this->cp;
  213.     }
  214.     public function setCp(string $cp): self
  215.     {
  216.         $this->cp $cp;
  217.         return $this;
  218.     }
  219.     public function getTelephone(): ?string
  220.     {
  221.         return $this->telephone;
  222.     }
  223.     public function setTelephone(string $telephone): self
  224.     {
  225.         $this->telephone $telephone;
  226.         return $this;
  227.     }
  228.     public function getAdresse1(): ?string
  229.     {
  230.         return $this->adresse1;
  231.     }
  232.     public function setAdresse1(string $adresse1): self
  233.     {
  234.         $this->adresse1 $adresse1;
  235.         return $this;
  236.     }
  237.     public function getAdresse2(): ?string
  238.     {
  239.         return $this->adresse2;
  240.     }
  241.     public function setAdresse2(string $adresse2): self
  242.     {
  243.         $this->adresse2 $adresse2;
  244.         return $this;
  245.     }
  246.     public function getVille(): ?string
  247.     {
  248.         return $this->ville;
  249.     }
  250.     public function setVille(string $ville): self
  251.     {
  252.         $this->ville $ville;
  253.         return $this;
  254.     }
  255.     public function getRegion(): ?string
  256.     {
  257.         return $this->region;
  258.     }
  259.     public function setRegion(string $region): self
  260.     {
  261.         $this->region $region;
  262.         return $this;
  263.     }
  264.     public function getPays(): ?string
  265.     {
  266.         return $this->pays;
  267.     }
  268.     public function setPays(string $pays): self
  269.     {
  270.         $this->pays $pays;
  271.         return $this;
  272.     }
  273.     public function getRaisonSocial(): ?string
  274.     {
  275.         return $this->raison_social;
  276.     }
  277.     public function setRaisonSocial(string $raison_social): self
  278.     {
  279.         $this->raison_social $raison_social;
  280.         return $this;
  281.     }
  282.     public function getRecevoirOffre(): ?string
  283.     {
  284.         return $this->recevoir_offre;
  285.     }
  286.     public function setRecevoirOffre(string $recevoir_offre): self
  287.     {
  288.         $this->recevoir_offre $recevoir_offre;
  289.         return $this;
  290.     }
  291.     // Ajoutez des getters et setters pour les autres propriétés
  292.     public function getId(): ?int
  293.     {
  294.         return $this->id;
  295.     }
  296.     public function getEmail(): ?string
  297.     {
  298.         return $this->email;
  299.     }
  300.     public function setEmail(string $email): self
  301.     {
  302.         $this->email $email;
  303.         return $this;
  304.     }
  305.     public function getPassword(): ?string
  306.     {
  307.         return $this->password;
  308.     }
  309.     public function setPassword(string $password): self
  310.     {
  311.         $this->password $password;
  312.         return $this;
  313.     }
  314.     public function getResetTokenExpiresAt(): ?\DateTimeInterface
  315.     {
  316.         return $this->resetTokenExpiresAt;
  317.     }
  318.     public function setResetTokenExpiresAt(?\DateTimeInterface $resetTokenExpiresAt): self
  319.     {
  320.         $this->resetTokenExpiresAt $resetTokenExpiresAt;
  321.         return $this;
  322.     }
  323.     #[ORM\PrePersist]
  324.     public function setCreatedAt(): void
  325.     {
  326.         $this->created = new \DateTime();
  327.     }
  328.     #[ORM\PrePersist]
  329.     #[ORM\PreUpdate]
  330.     public function setUpdatedAt(): void
  331.     {
  332.         $this->changed = new \DateTime();
  333.     }
  334.     // Getters et setters
  335.     public function setCreated(): self
  336.     {
  337.         $this->created = new \DateTime();
  338.         return $this;
  339.     }
  340.     public function getCreated(): ?\DateTime
  341.     {
  342.         return $this->created;
  343.     }
  344.     public function setChanged(): self
  345.     {
  346.         $this->changed = new \DateTime();
  347.         return $this;
  348.     }
  349.     public function getChanged(): ?\DateTime
  350.     {
  351.         return $this->changed;
  352.     }
  353.     public function getRoles()
  354.     {
  355.         // TODO: Implement getRoles() method.
  356.         // Retourne un tableau contenant au moins ROLE_USER
  357.         $roles $this->roles;
  358.         $roles[] = 'ROLE_USER';
  359.         return array_unique($roles); // Supprime les doublons
  360.     }
  361.     public function getResetToken(): ?string
  362.     {
  363.         return $this->resetToken;
  364.     }
  365.     public function setResetToken(?string $resetToken): self
  366.     {
  367.         $this->resetToken $resetToken;
  368.         return $this;
  369.     }
  370.     public function getSalt()
  371.     {
  372.         // TODO: Implement getSalt() method.
  373.     }
  374.     public function eraseCredentials()
  375.     {
  376.         // TODO: Implement eraseCredentials() method.
  377.     }
  378.     /**
  379.      * A visual identifier that represents this user.
  380.      *
  381.      * @see UserInterface
  382.      */
  383.     public function getUserIdentifier(): string
  384.     {
  385.         return (string)$this->email;
  386.     }
  387.     public function getUsername()
  388.     {
  389.         // TODO: Implement getUsername() method.
  390.     }
  391.     public function setCrSdr($cr_sdr) :self
  392.     {
  393.         $this->cr_sdr $cr_sdr;
  394.         return $this;
  395.     }
  396.     public function getCrSdr(): int
  397.     {
  398.         return $this->cr_sdr $this->cr_sdr 0;
  399.     }
  400.     public function setCrMijourne($cr_mijourne) :self
  401.     {
  402.         $this->cr_mijourne $cr_mijourne;
  403.         return $this;
  404.     }
  405.     public function getCrMijourne(): int
  406.     {
  407.         return $this->cr_mijourne $this->cr_mijourne 0;
  408.     }
  409.     public function setCrJourne($cr_journe) :self
  410.     {
  411.         $this->cr_journe $cr_journe;
  412.         return $this;
  413.     }
  414.     public function getCrJourne(): int
  415.     {
  416.         return $this->cr_journe $this->cr_journe 0;
  417.     }
  418.     public function setCrMois($cr_mois) :self
  419.     {
  420.         $this->cr_mois $cr_mois;
  421.         return $this;
  422.     }
  423.     public function getCrMois(): int
  424.     {
  425.         return $this->cr_mois $this->cr_mois 0;
  426.     }
  427.     public function getTransactions(): Collection
  428.     {
  429.         if(empty($this->transactions))
  430.             $this->transactions = new ArrayCollection();
  431.         return $this->transactions;
  432.     }
  433.     public function setTransactions($transactions): self
  434.     {
  435.         $this->transactions $transactions;
  436.         return $this;
  437.     }
  438.     public function addTransaction(Transaction $transaction): self
  439.     {
  440.         if (!$this->transactions->contains($transaction)) {
  441.             $this->transactions[] = $transaction;
  442.             $transaction->setClient($this);
  443.         }
  444.         return $this;
  445.     }
  446.     public function removeTransaction(Transaction $transaction): self
  447.     {
  448.         if ($this->transactions->removeElement($transaction)) {
  449.             // Set the owning side to null (unless already changed)
  450.             if ($transaction->getClient() === $this) {
  451.                 $transaction->setClient(null);
  452.             }
  453.         }
  454.         return $this;
  455.     }
  456.     public function setEmailFacturation($email_facturation): self
  457.     {
  458.         $this->email_facturation $email_facturation;
  459.         return $this;
  460.     }
  461.     public function getEmailFacturation(): string
  462.     {
  463.         return $this->email_facturation;
  464.     }
  465.     public function setSiret($siret): self
  466.     {
  467.         $this->siret $siret;
  468.         return $this;
  469.     }
  470.     public function getSiret(): string
  471.     {
  472.         return $this->siret;
  473.     }
  474.     public function setTva($tva): self
  475.     {
  476.         $this->tva $tva;
  477.         return $this;
  478.     }
  479.     public function getTva(): int
  480.     {
  481.         return $this->tva;
  482.     }
  483.     public function setTvaApplicable($tva_applicable): self
  484.     {
  485.         $this->tva_applicable $tva_applicable;
  486.         return $this;
  487.     }
  488.     public function getTvaApplicable(): int
  489.     {
  490.         return $this->tva_applicable;
  491.     }
  492.     public function setRibEtablissement($rib_etablissement): self
  493.     {
  494.         $this->rib_etablissement $rib_etablissement;
  495.         return $this;
  496.     }
  497.     public function getRibEtablissement(): string
  498.     {
  499.         return $this->rib_etablissement;
  500.     }
  501.     public function setRibRice($rib_rice): self
  502.     {
  503.         $this->rib_rice $rib_rice;
  504.         return $this;
  505.     }
  506.     public function getRibRice(): string
  507.     {
  508.         return $this->rib_rice;
  509.     }
  510.     public function setRibGuichet($rib_guichet): self
  511.     {
  512.         $this->rib_guichet $rib_guichet;
  513.         return $this;
  514.     }
  515.     public function getRibGuichet(): string
  516.     {
  517.         return $this->rib_guichet;
  518.     }
  519.     public function setRibIban($rib_iban): self
  520.     {
  521.         $this->rib_iban $rib_iban;
  522.         return $this;
  523.     }
  524.     public function getRibIban(): string
  525.     {
  526.         return $this->rib_iban;
  527.     }
  528.     public function setRibCompte($rib_compte): self
  529.     {
  530.         $this->rib_compte $rib_compte;
  531.         return $this;
  532.     }
  533.     public function getRibCompte(): string
  534.     {
  535.         return $this->rib_compte;
  536.     }
  537.     public function setRibBic($rib_bic): self
  538.     {
  539.         $this->rib_bic $rib_bic;
  540.         return $this;
  541.     }
  542.     public function getRibBic(): string
  543.     {
  544.         return $this->rib_bic;
  545.     }
  546.     public function setDomiciliation($domiciliation): self
  547.     {
  548.         $this->domiciliation $domiciliation;
  549.         return $this;
  550.     }
  551.     public function getDomiciliation(): string
  552.     {
  553.         return $this->domiciliation;
  554.     }
  555.     public function getDeleted(): bool
  556.     {
  557.         return $this->deleted;
  558.     }
  559.     public function setDeleted($deleted): self
  560.     {
  561.         $this->deleted $deleted;
  562.         return $this;
  563.     }
  564.     public function getAbonnement(): ?Abonnement
  565.     {
  566.         return $this->abonnement;
  567.     }
  568. }