src/Entity/UserPlatform.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserPlatformRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  8. use Symfony\Component\Security\Core\User\UserInterface;
  9. /**
  10.  * @ORM\Entity(repositoryClass=UserPlatformRepository::class)
  11.  */
  12. class UserPlatform implements UserInterfacePasswordAuthenticatedUserInterface
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=180, unique=true)
  22.      */
  23.     private $email;
  24.     /**
  25.      * @ORM\Column(type="json")
  26.      */
  27.     private $roles = [];
  28.     /**
  29.      * @var string The hashed password
  30.      * @ORM\Column(type="string")
  31.      */
  32.     private $password;
  33.     /**
  34.      * @ORM\Column(type="string", nullable=true)
  35.      */
  36.     private ?string $resetToken null;
  37.     /**
  38.      * @ORM\Column(type="datetime", nullable=true)
  39.      */
  40.     private ?\DateTimeInterface $tokenExpiration null;
  41.     /**
  42.      * @ORM\Column(type="string", length=255)
  43.      */
  44.     private $nameuser;
  45.     /**
  46.      * @ORM\Column(type="string", length=255)
  47.      */
  48.     private $adresse;
  49.     /**
  50.      * @ORM\Column(type="string", length=255, nullable=true)
  51.      */
  52.     private $adresseLivraison;
  53.     /**
  54.      * @ORM\Column(type="string", length=255, nullable=true)
  55.      */
  56.     private $phone;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      */
  60.     private $mail;
  61.     /**
  62.      * @ORM\OneToMany(targetEntity=Order::class, mappedBy="customer")
  63.      */
  64.     private $listOrders;
  65.     public function __construct()
  66.     {
  67.         $this->listOrders = new ArrayCollection();
  68.     }
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getEmail(): ?string
  74.     {
  75.         return $this->email;
  76.     }
  77.     public function setEmail(string $email): self
  78.     {
  79.         $this->email $email;
  80.         return $this;
  81.     }
  82.     /**
  83.      * A visual identifier that represents this user.
  84.      *
  85.      * @see UserInterface
  86.      */
  87.     public function getUserIdentifier(): string
  88.     {
  89.         return (string) $this->email;
  90.     }
  91.     /**
  92.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  93.      */
  94.     public function getUsername(): string
  95.     {
  96.         return (string) $this->email;
  97.     }
  98.     /**
  99.      * @see UserInterface
  100.      */
  101.     public function getRoles(): array
  102.     {
  103.         $roles $this->roles;
  104.         // guarantee every user at least has ROLE_USER
  105.         $roles[] = 'ROLE_USER';
  106.         return array_unique($roles);
  107.     }
  108.     public function setRoles(array $roles): self
  109.     {
  110.         $this->roles $roles;
  111.         return $this;
  112.     }
  113.     /**
  114.      * @see PasswordAuthenticatedUserInterface
  115.      */
  116.     public function getPassword(): string
  117.     {
  118.         return $this->password;
  119.     }
  120.     public function setPassword(string $password): self
  121.     {
  122.         $this->password $password;
  123.         return $this;
  124.     }
  125.     /**
  126.      * Returning a salt is only needed, if you are not using a modern
  127.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  128.      *
  129.      * @see UserInterface
  130.      */
  131.     public function getSalt(): ?string
  132.     {
  133.         return null;
  134.     }
  135.     /**
  136.      * @see UserInterface
  137.      */
  138.     public function eraseCredentials()
  139.     {
  140.         // If you store any temporary, sensitive data on the user, clear it here
  141.         // $this->plainPassword = null;
  142.     }
  143.     public function getNameuser(): ?string
  144.     {
  145.         return $this->nameuser;
  146.     }
  147.     public function setNameuser(string $nameuser): self
  148.     {
  149.         $this->nameuser $nameuser;
  150.         return $this;
  151.     }
  152.     public function getAdresse(): ?string
  153.     {
  154.         return $this->adresse;
  155.     }
  156.     public function setAdresse(string $adresse): self
  157.     {
  158.         $this->adresse $adresse;
  159.         return $this;
  160.     }
  161.     public function getAdresseLivraison(): ?string
  162.     {
  163.         return $this->adresseLivraison;
  164.     }
  165.     public function setAdresseLivraison(string $adresseLivraison): self
  166.     {
  167.         $this->adresseLivraison $adresseLivraison;
  168.         return $this;
  169.     }
  170.     public function getPhone(): ?string
  171.     {
  172.         return $this->phone;
  173.     }
  174.     public function setPhone(?string $phone): self
  175.     {
  176.         $this->phone $phone;
  177.         return $this;
  178.     }
  179.     public function getMail(): ?string
  180.     {
  181.         return $this->mail;
  182.     }
  183.     public function setMail(?string $mail): self
  184.     {
  185.         $this->mail $mail;
  186.         return $this;
  187.     }
  188.     /**
  189.      * @return Collection<int, Order>
  190.      */
  191.     public function getListOrders(): Collection
  192.     {
  193.         return $this->listOrders;
  194.     }
  195.     public function addListOrder(Order $listOrder): self
  196.     {
  197.         if (!$this->listOrders->contains($listOrder)) {
  198.             $this->listOrders[] = $listOrder;
  199.             $listOrder->setCustomer($this);
  200.         }
  201.         return $this;
  202.     }
  203.     public function removeListOrder(Order $listOrder): self
  204.     {
  205.         if ($this->listOrders->removeElement($listOrder)) {
  206.             // set the owning side to null (unless already changed)
  207.             if ($listOrder->getCustomer() === $this) {
  208.                 $listOrder->setCustomer(null);
  209.             }
  210.         }
  211.         return $this;
  212.     }
  213.     public function __toString()
  214.     {
  215.         return $this->getNameuser(); // Remplacez getName() par la méthode appropriée pour obtenir une représentation sous forme de chaîne.
  216.     }
  217.     /**
  218.      * Get the value of resetToken
  219.      */
  220.     public function getResetToken(): ?string
  221.     {
  222.         return $this->resetToken;
  223.     }
  224.     /**
  225.      * Set the value of resetToken
  226.      */
  227.     public function setResetToken(?string $resetToken): self
  228.     {
  229.         $this->resetToken $resetToken;
  230.         return $this;
  231.     }
  232.     /**
  233.      * Get the value of tokenExpiration
  234.      */
  235.     public function getTokenExpiration(): ?\DateTimeInterface
  236.     {
  237.         return $this->tokenExpiration;
  238.     }
  239.     /**
  240.      * Set the value of tokenExpiration
  241.      */
  242.     public function setTokenExpiration(?\DateTimeInterface $tokenExpiration): self
  243.     {
  244.         $this->tokenExpiration $tokenExpiration;
  245.         return $this;
  246.     }
  247. }