src/Entity/AppUser.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AppUserRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  6. use Symfony\Component\Security\Core\User\UserInterface;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. /**
  10.  * @ORM\Entity(repositoryClass=AppUserRepository::class)
  11.  * @ORM\HasLifecycleCallbacks()
  12.  */
  13. class AppUser implements UserInterfacePasswordAuthenticatedUserInterface
  14. {
  15.     /**
  16.     * @Gedmo\Slug(fields={"username"})
  17.     * @ORM\Column(length=128, unique=false)
  18.     */
  19.     private $slugUsername;
  20.     
  21.     /**
  22.      * @ORM\OneToOne(targetEntity="\App\Entity\Photo", cascade={"persist", "remove"})
  23.      */
  24.     private $avatar;
  25.     
  26.     /**
  27.      * @ORM\Id
  28.      * @ORM\GeneratedValue
  29.      * @ORM\Column(type="integer")
  30.      */
  31.     private $id;
  32.     /**
  33.      * @ORM\Column(type="string", length=180, unique=true)
  34.      */
  35.     private $email;
  36.     /**
  37.      * @ORM\Column(type="string", length=255, nullable=true)
  38.      */
  39.     private $monPropreCodePromo;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=true)
  42.      */
  43.     private $codePromoUtilise;
  44.     /**
  45.      * @ORM\Column(type="string", length=1024, nullable=true)
  46.      */
  47.     private $pushNotificationToken;
  48.     /**
  49.      * @ORM\Column(type="string", length=255, nullable=true)
  50.      */
  51.     private $emailToken;
  52.     /**
  53.      * @ORM\Column(type="float",  nullable=true)
  54.      */
  55.     private $tokenExpireAt;
  56.     
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      */
  60.     private $casierJudiciaire;
  61.      /**
  62.      * @ORM\Column(type="string", length=255, nullable=true)
  63.      */
  64.     private $pieceDIdentiteRecto;
  65.     /**
  66.      * @ORM\Column(type="string", length=255, nullable=true)
  67.      */
  68.     private $pieceDIdentiteVerso;
  69.     /**
  70.      * @ORM\Column(type="string", length=255, unique=false)
  71.      */
  72.     private $username;
  73.     /**
  74.      * @ORM\Column(type="json")
  75.      */
  76.     private $roles = [];
  77.     /**
  78.      * @var string The hashed password
  79.      * @ORM\Column(type="string")
  80.      */
  81.     private $password;
  82.     
  83.      /**
  84.      * @var string
  85.      *
  86.      * @ORM\Column(name="nom", type="string", length=255, nullable=true)
  87.      */
  88.     private $nom;
  89.     /**
  90.      * @var string
  91.      *
  92.      * @ORM\Column(name="prenom", type="string", length=255, nullable=true)
  93.      */
  94.     private $prenom;
  95.     
  96.     
  97.     /**
  98.      * @var string
  99.      *
  100.      * @ORM\Column(name="code", type="string", length=50, nullable=true)
  101.      */
  102.     private $code;
  103.     
  104.     
  105.     /**
  106.      * @var string
  107.      *
  108.      * @ORM\Column(name="sexe", type="string", length=10, nullable=true)
  109.      */
  110.     private $sexe;
  111.     
  112.     
  113.     
  114.     /**
  115.      * @var string
  116.      *
  117.      * @ORM\Column(name="est_supprime", type="boolean", nullable=true)
  118.      */
  119.     private $estSupprime;
  120.     /**
  121.      * @var string
  122.      *
  123.      * @ORM\Column(name="telephone", type="string", length=255, nullable=true)
  124.      */
  125.     private $telephone;
  126.     /**
  127.      * @var string
  128.      *
  129.      * @ORM\Column(name="adresse", type="string", length=255, nullable=true)
  130.      */
  131.     private $adresse;
  132.     /**
  133.      * @var string
  134.      *
  135.      * @ORM\Column(name="type_compte", type="string", length=255, nullable=true)
  136.      */
  137.     private $typeCompte;
  138.  
  139.     
  140.     /**
  141.      * @var string
  142.      *
  143.      * @ORM\Column(name="nom_complet", type="string", length=255, nullable=true)
  144.      */
  145.     private $nomComplet;
  146.     /**
  147.      * @var string
  148.      *
  149.      * @ORM\Column(name="mois", type="string", length=255, nullable=true)
  150.      */
  151.     private $mois;
  152.     /**
  153.      * @var string
  154.      *
  155.      * @ORM\Column(name="annee", type="string", length=255, nullable=true)
  156.      */
  157.     private $annee;
  158.     /**
  159.      * @var string
  160.      *
  161.      * @ORM\Column(name="nombre_avis", type="integer", nullable=true)
  162.      */
  163.     private $nombreAvis;
  164.     
  165.     
  166.     /**
  167.      * @var string
  168.      */
  169.     private $plainPassword;
  170.     /**
  171.      * @var \DateTime
  172.      *
  173.      * @ORM\Column(name="created_at", type="datetime", nullable=false)
  174.      */
  175.     private $createdAt;
  176.     /**
  177.      * @var string
  178.      *
  179.      * @ORM\Column(name="qualification", type="string", length=255, nullable=true)
  180.      */
  181.     private $qualification;
  182.     /**
  183.      * @var string
  184.      *
  185.      * @ORM\Column(name="description", type="text", nullable=true)
  186.      */
  187.     private $description;
  188.     /**
  189.      * @var string
  190.      *
  191.      * @ORM\Column(name="disponibilite", type="string", length=225, nullable=true)
  192.      */
  193.     private $disponibilite;
  194.     
  195.     
  196.     /**
  197.      * @var boolean
  198.      *
  199.      * @ORM\Column(name="enabled", type="boolean", nullable=true)
  200.      */
  201.     private $enabled;
  202.     
  203.     
  204.     /**
  205.      * @var string
  206.      *
  207.      * @ORM\Column(name="gamme_de_prix", type="string", length=225, nullable=true)
  208.      */
  209.     private $gammeDePrix;
  210.     /**
  211.      * @var string
  212.      *
  213.      * @ORM\Column(name="main_d_oeuvre", type="string", length=225, nullable=true)
  214.      */
  215.     private $mainDOeuvre;
  216.     /**
  217.      * @var string
  218.      *
  219.      * @ORM\Column(name="zone_d_intervention", type="string", length=225, nullable=true)
  220.      */
  221.     private $zoneDIntervention;
  222.     /**
  223.      * @var string
  224.      *
  225.      * @ORM\Column(name="domaine_d_activite", type="string", length=225, nullable=true)
  226.      */
  227.     private $domaineDActivite;
  228.     /**
  229.      * @var string
  230.      *
  231.      * @ORM\Column(name="est_embassadeur", type="boolean", nullable=true)
  232.      */
  233.     private $estEmbassadeur;
  234.     /**
  235.      * Constructor
  236.      */
  237.     public function __construct()
  238.     {
  239.         $this->roles = ['ROLE_USER'];
  240.         $this->createdAt = new \DateTime('now');
  241.         $p = new Photo;
  242.         $p->setUrl('image/male-user.png');
  243.         $p->setAlt('Photo de profile');
  244.         $this->avatar $p;
  245.         $this->mois date('mY');
  246.         $this->annee date('Y');
  247.         $this->nombreAvis 0
  248.         $this->typeCompte "Personnel"
  249.         $this->estSupprime false;
  250.         $this->monPropreCodePromo 'H'.random_int(100000999999);
  251.        
  252.     }
  253.     public function getId(): ?int
  254.     {
  255.         return $this->id;
  256.     }
  257.     public function getEmail(): ?string
  258.     {
  259.         return $this->email;
  260.     }
  261.     public function setEmail(string $email): self
  262.     {
  263.         $this->email $email;
  264.         return $this;
  265.     }
  266.     /**
  267.      * A visual identifier that represents this user.
  268.      *
  269.      * @see UserInterface
  270.      */
  271.     public function getUserIdentifier(): string
  272.     {
  273.         return (string) $this->email;
  274.     }
  275.     /**
  276.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  277.      */
  278.     public function getUsername(): string
  279.     {
  280.         return (string) $this->username;
  281.     }
  282.     /**
  283.      * @see UserInterface
  284.      */
  285.     public function getRoles(): array
  286.     {
  287.         $roles $this->roles;
  288.         // guarantee every user at least has ROLE_USER
  289.         $roles[] = 'ROLE_USER';
  290.         return array_unique($roles);
  291.     }
  292.     public function setRoles(array $roles): self
  293.     {
  294.         $this->roles $roles;
  295.         return $this;
  296.     }
  297.     /**
  298.      * @see PasswordAuthenticatedUserInterface
  299.      */
  300.     public function getPassword(): string
  301.     {
  302.         return $this->password;
  303.     }
  304.     public function setPassword(string $password): self
  305.     {
  306.         $this->password $password;
  307.         return $this;
  308.     }
  309.     /**
  310.      * Returning a salt is only needed, if you are not using a modern
  311.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  312.      *
  313.      * @see UserInterface
  314.      */
  315.     public function getSalt(): ?string
  316.     {
  317.         return null;
  318.     }
  319.     /**
  320.      * @see UserInterface
  321.      */
  322.     public function eraseCredentials()
  323.     {
  324.         // If you store any temporary, sensitive data on the user, clear it here
  325.         // $this->plainPassword = null;
  326.     }
  327.     public function getNom(): ?string
  328.     {
  329.         return $this->nom;
  330.     }
  331.     public function setNom(?string $nom): self
  332.     {
  333.         $this->nom $nom;
  334.         return $this;
  335.     }
  336.     public function getCode(): ?string
  337.     {
  338.         return $this->code;
  339.     }
  340.     public function setCode(?string $code): self
  341.     {
  342.         $this->code $code;
  343.         return $this;
  344.     }
  345.     public function getPrenom(): ?string
  346.     {
  347.         return $this->prenom;
  348.     }
  349.     public function setPrenom(?string $prenom): self
  350.     {
  351.         $this->prenom $prenom;
  352.         return $this;
  353.     }
  354.     public function getSexe(): ?string
  355.     {
  356.         return $this->sexe;
  357.     }
  358.     public function setSexe(?string $sexe): self
  359.     {
  360.         $this->sexe $sexe;
  361.         return $this;
  362.     }
  363.     public function getTelephone(): ?string
  364.     {
  365.         return $this->telephone;
  366.     }
  367.     public function setTelephone(?string $telephone): self
  368.     {
  369.         $this->telephone $telephone;
  370.         return $this;
  371.     }
  372.     public function getNomComplet(): ?string
  373.     {
  374.         return $this->nomComplet;
  375.     }
  376.     public function setNomComplet(?string $nomComplet): self
  377.     {
  378.         $this->nomComplet $nomComplet;
  379.         return $this;
  380.     }
  381.     
  382.     /**
  383.      * 
  384.      */
  385.     public function getPlainPassword(): string
  386.     {
  387.         return $this->plainPassword;
  388.     }
  389.     public function setPlainPassword(string $plainPassword): self
  390.     {
  391.         $this->plainPassword $plainPassword;
  392.         return $this;
  393.     }
  394.     public function setUsername(string $username): self
  395.     {
  396.         $this->username $username;
  397.         return $this;
  398.     }
  399.     public function getAvatar(): ?Photo
  400.     {
  401.         return $this->avatar;
  402.     }
  403.     public function setAvatar(?Photo $avatar): self
  404.     {
  405.         $this->avatar $avatar;
  406.         return $this;
  407.     }
  408.     public function getSlugUsername(): ?string
  409.     {
  410.         return $this->slugUsername;
  411.     }
  412.     public function setSlugUsername(string $slugUsername): self
  413.     {
  414.         $this->slugUsername $slugUsername;
  415.         return $this;
  416.     }
  417.     /**
  418.      *@ORM\PreUpdate
  419.      */
  420.     public function preUpdateClasse()
  421.     {
  422.          $this->formaterNom();
  423.     }
  424.     
  425.     /**
  426.     * @ORM\PrePersist
  427.     */
  428.     
  429.     public function prePersistClasse()
  430.                                               {
  431.                                                   $this->formaterNom();
  432.                                               }
  433.     public function formaterNom()
  434.     {
  435.         $this->nomComplet $this->nom.' '.$this->prenom;
  436.         $this->username $this->nom.$this->prenom.time();
  437.     }
  438.     public function getAdresse(): ?string
  439.     {
  440.         return $this->adresse;
  441.     }
  442.     public function setAdresse(?string $adresse): self
  443.     {
  444.         $this->adresse $adresse;
  445.         return $this;
  446.     }
  447.     public function getTypeCompte(): ?string
  448.     {
  449.         return $this->typeCompte;
  450.     }
  451.     public function setTypeCompte(?string $typeCompte): self
  452.     {
  453.         $this->typeCompte $typeCompte;
  454.         return $this;
  455.     }
  456.      /**
  457.      * @return mixed
  458.      */
  459.     public function getEnabled()
  460.     {
  461.         return $this->enabled;
  462.     }
  463.     /**
  464.      * @param mixed $enabled
  465.      * @return Users
  466.      */
  467.     public function setEnabled($enabled)
  468.     {
  469.         $this->enabled $enabled;
  470.         return $this;
  471.     }
  472.     public function getMois(): ?string
  473.     {
  474.         return $this->mois;
  475.     }
  476.     public function setMois(?string $mois): self
  477.     {
  478.         $this->mois $mois;
  479.         return $this;
  480.     }
  481.     public function getAnnee(): ?string
  482.     {
  483.         return $this->annee;
  484.     }
  485.     public function setAnnee(?string $annee): self
  486.     {
  487.         $this->annee $annee;
  488.         return $this;
  489.     }
  490.     public function getNombreAvis(): ?int
  491.     {
  492.         return $this->nombreAvis;
  493.     }
  494.     public function setNombreAvis(?int $nombreAvis): self
  495.     {
  496.         $this->nombreAvis $nombreAvis;
  497.         return $this;
  498.     }
  499.     public function getCreatedAt(): ?\DateTimeInterface
  500.     {
  501.         return $this->createdAt;
  502.     }
  503.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  504.     {
  505.         $this->createdAt $createdAt;
  506.         return $this;
  507.     }
  508.     public function getQualification(): ?string
  509.     {
  510.         return $this->qualification;
  511.     }
  512.     public function setQualification(?string $qualification): self
  513.     {
  514.         $this->qualification $qualification;
  515.         return $this;
  516.     }
  517.     public function getDescription(): ?string
  518.     {
  519.         return $this->description;
  520.     }
  521.     public function setDescription(?string $description): self
  522.     {
  523.         $this->description $description;
  524.         return $this;
  525.     }
  526.     public function getDisponibilite(): ?string
  527.     {
  528.         return $this->disponibilite;
  529.     }
  530.     public function setDisponibilite(?string $disponibilite): self
  531.     {
  532.         $this->disponibilite $disponibilite;
  533.         return $this;
  534.     }
  535.     public function getGammeDePrix(): ?string
  536.     {
  537.         return $this->gammeDePrix;
  538.     }
  539.     public function setGammeDePrix(?string $gammeDePrix): self
  540.     {
  541.         $this->gammeDePrix $gammeDePrix;
  542.         return $this;
  543.     }
  544.     public function getMainDOeuvre(): ?string
  545.     {
  546.         return $this->mainDOeuvre;
  547.     }
  548.     public function setMainDOeuvre(?string $mainDOeuvre): self
  549.     {
  550.         $this->mainDOeuvre $mainDOeuvre;
  551.         return $this;
  552.     }
  553.     public function getZoneDIntervention(): ?string
  554.     {
  555.         return $this->zoneDIntervention;
  556.     }
  557.     public function setZoneDIntervention(?string $zoneDIntervention): self
  558.     {
  559.         $this->zoneDIntervention $zoneDIntervention;
  560.         return $this;
  561.     }
  562.     public function getDomaineDActivite(): ?string
  563.     {
  564.         return $this->domaineDActivite;
  565.     }
  566.     public function setDomaineDActivite(?string $domaineDActivite): self
  567.     {
  568.         $this->domaineDActivite $domaineDActivite;
  569.         return $this;
  570.     }
  571.     public function isEstEmbassadeur(): ?bool
  572.     {
  573.         return $this->estEmbassadeur;
  574.     }
  575.     public function setEstEmbassadeur(?bool $estEmbassadeur): self
  576.     {
  577.         $this->estEmbassadeur $estEmbassadeur;
  578.         return $this;
  579.     }
  580.     public function isEnabled(): ?bool
  581.     {
  582.         return $this->enabled;
  583.     }
  584.     public function getEmailToken(): ?string
  585.     {
  586.         return $this->emailToken;
  587.     }
  588.     public function setEmailToken(?string $emailToken): self
  589.     {
  590.         $this->emailToken $emailToken;
  591.         return $this;
  592.     }
  593.     public function isEstSupprime(): ?bool
  594.     {
  595.         return $this->estSupprime;
  596.     }
  597.     public function setEstSupprime(?bool $estSupprime): self
  598.     {
  599.         $this->estSupprime $estSupprime;
  600.         return $this;
  601.     }
  602.     public function getPieceDIdentiteRecto(): ?string
  603.     {
  604.         return $this->pieceDIdentiteRecto;
  605.     }
  606.     public function setPieceDIdentiteRecto(?string $pieceDIdentiteRecto): self
  607.     {
  608.         $this->pieceDIdentiteRecto $pieceDIdentiteRecto;
  609.         return $this;
  610.     }
  611.     public function getPieceDIdentiteVerso(): ?string
  612.     {
  613.         return $this->pieceDIdentiteVerso;
  614.     }
  615.     public function setPieceDIdentiteVerso(?string $pieceDIdentiteVerso): self
  616.     {
  617.         $this->pieceDIdentiteVerso $pieceDIdentiteVerso;
  618.         return $this;
  619.     }
  620.     public function getPushNotificationToken(): ?string
  621.     {
  622.         return $this->pushNotificationToken;
  623.     }
  624.     public function setPushNotificationToken(?string $pushNotificationToken): self
  625.     {
  626.         $this->pushNotificationToken $pushNotificationToken;
  627.         return $this;
  628.     }
  629.     public function getMonPropreCodePromo(): ?string
  630.     {
  631.         return $this->monPropreCodePromo;
  632.     }
  633.     public function setMonPropreCodePromo(?string $monPropreCodePromo): self
  634.     {
  635.         $this->monPropreCodePromo $monPropreCodePromo;
  636.         return $this;
  637.     }
  638.     public function getCodePromoUtilise(): ?string
  639.     {
  640.         return $this->codePromoUtilise;
  641.     }
  642.     public function setCodePromoUtilise(?string $codePromoUtilise): self
  643.     {
  644.         $this->codePromoUtilise $codePromoUtilise;
  645.         return $this;
  646.     }
  647.     public function getTokenExpireAt(): ?float
  648.     {
  649.         return $this->tokenExpireAt;
  650.     }
  651.     public function setTokenExpireAt(?float $tokenExpireAt): self
  652.     {
  653.         $this->tokenExpireAt $tokenExpireAt;
  654.         return $this;
  655.     }
  656.     public function getCasierJudiciaire(): ?string
  657.     {
  658.         return $this->casierJudiciaire;
  659.     }
  660.     public function setCasierJudiciaire(?string $casierJudiciaire): self
  661.     {
  662.         $this->casierJudiciaire $casierJudiciaire;
  663.         return $this;
  664.     }
  665.     
  666. }