src/Entity/User.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  6. use Symfony\Component\Security\Core\User\UserInterface;
  7. /**
  8.  * @ORM\Entity(repositoryClass=UserRepository::class)
  9.  */
  10. class User implements UserInterfacePasswordAuthenticatedUserInterface
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=180, unique=true)
  20.      */
  21.     private $email;
  22.     /**
  23.      * @ORM\Column(type="json")
  24.      */
  25.     private $roles = [];
  26.     /**
  27.      * @ORM\Column(type="integer")
  28.      */
  29.     private $id_role;
  30.     /**
  31.      * @return mixed
  32.      */
  33.     public function getIdRole()
  34.     {
  35.         return $this->id_role;
  36.     }
  37.     /**
  38.      * @param mixed $id_role
  39.      */
  40.     public function setIdRole($id_role): void
  41.     {
  42.         $this->id_role $id_role;
  43.     }
  44.     /**
  45.      * @var string The hashed password
  46.      * @ORM\Column(type="string")
  47.      */
  48.     private $password;
  49.     /**
  50.      * @ORM\Column(type="integer", nullable=true)
  51.      */
  52.     private $id_tiers;
  53.     /**
  54.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
  55.      */
  56.     private $date_crea;
  57.     /**
  58.      * @ORM\Column(type="integer")
  59.      */
  60.     private $user_crea;
  61.     /**
  62.      * @ORM\Column(type="datetime", nullable=true)
  63.      */
  64.     private $date_modif;
  65.     /**
  66.      * @ORM\Column(type="integer", nullable=true)
  67.      */
  68.     private $user_modif;
  69.     /**
  70.      * @ORM\Column(type="integer", nullable=true)
  71.      */
  72.     private $password_requested_at;
  73.     /**
  74.      * @ORM\Column(type="string", length=255, nullable=true)
  75.      */
  76.     private $token;
  77.     /**
  78.      * @ORM\Column(type="string", length=255, nullable=true)
  79.      */
  80.     private $avatar_user;
  81.     /**
  82.      * @ORM\Column(type="string", length=20, nullable=true)
  83.      */
  84.     private $theme_user;
  85.     /**
  86.      * @ORM\Column(type="boolean", options={"default": 1})
  87.      */
  88.     private $is_active;
  89.     /**
  90.      * @ORM\Column(type="json", nullable=true)
  91.      */
  92.     private $workflow_column_preferences;
  93.     /**
  94.      * @ORM\OneToOne(targetEntity=Tiers::class, inversedBy="user", cascade={"persist", "remove"})
  95.      */
  96.     private $tiers;
  97.     public function clearForJsonResp(){
  98.         $this->getTiers()->clearForJsonResp();
  99.     }
  100.     public function getId(): ?int
  101.     {
  102.         return $this->id;
  103.     }
  104.     public function getEmail(): ?string
  105.     {
  106.         return $this->email;
  107.     }
  108.     public function setEmail(string $email): self
  109.     {
  110.         $this->email $email;
  111.         return $this;
  112.     }
  113.     /**
  114.      * A visual identifier that represents this user.
  115.      *
  116.      * @see UserInterface
  117.      */
  118.     public function getUserIdentifier(): string
  119.     {
  120.         return (string) $this->email;
  121.     }
  122.     /**
  123.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  124.      */
  125.     public function getUsername(): string
  126.     {
  127.         return (string) $this->email;
  128.     }
  129.     /**
  130.      * @see UserInterface
  131.      */
  132.     public function getRoles(): array
  133.     {
  134.         $roles $this->roles;
  135.         // guarantee every user at least has ROLE_USER
  136.         $roles[] = 'ROLE_USER';
  137.         return array_unique($roles);
  138.     }
  139.     public function setRoles(array $roles): self
  140.     {
  141.         $this->roles $roles;
  142.         return $this;
  143.     }
  144.     /**
  145.      * @see PasswordAuthenticatedUserInterface
  146.      */
  147.     public function getPassword(): string
  148.     {
  149.         return $this->password;
  150.     }
  151.     public function setPassword(string $password): self
  152.     {
  153.         $this->password $password;
  154.         return $this;
  155.     }
  156.     /**
  157.      * Returning a salt is only needed, if you are not using a modern
  158.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  159.      *
  160.      * @see UserInterface
  161.      */
  162.     public function getSalt(): ?string
  163.     {
  164.         return null;
  165.     }
  166.     /**
  167.      * @see UserInterface
  168.      */
  169.     public function eraseCredentials()
  170.     {
  171.         // If you store any temporary, sensitive data on the user, clear it here
  172.         // $this->plainPassword = null;
  173.     }
  174.     public function getIdTiers(): ?int
  175.     {
  176.         return $this->id_tiers;
  177.     }
  178.     public function setIdTiers(?int $id_tiers): self
  179.     {
  180.         $this->id_tiers $id_tiers;
  181.         return $this;
  182.     }
  183.     public function getDateCrea(): ?\DateTimeInterface
  184.     {
  185.         return $this->date_crea;
  186.     }
  187.     public function setDateCrea(\DateTimeInterface $date_crea): self
  188.     {
  189.         $this->date_crea $date_crea;
  190.         return $this;
  191.     }
  192.     public function getUserCrea(): ?int
  193.     {
  194.         return $this->user_crea;
  195.     }
  196.     public function setUserCrea(int $user_crea): self
  197.     {
  198.         $this->user_crea $user_crea;
  199.         return $this;
  200.     }
  201.     public function getDateModif(): ?\DateTimeInterface
  202.     {
  203.         return $this->date_modif;
  204.     }
  205.     public function setDateModif(?\DateTimeInterface $date_modif): self
  206.     {
  207.         $this->date_modif $date_modif;
  208.         return $this;
  209.     }
  210.     public function getUserModif(): ?int
  211.     {
  212.         return $this->user_modif;
  213.     }
  214.     public function setUserModif(?int $user_modif): self
  215.     {
  216.         $this->user_modif $user_modif;
  217.         return $this;
  218.     }
  219.     public function getPasswordRequestedAt(): ?int
  220.     {
  221.         return $this->password_requested_at;
  222.     }
  223.     public function setPasswordRequestedAt(?int $password_requested_at): self
  224.     {
  225.         $this->password_requested_at $password_requested_at;
  226.         return $this;
  227.     }
  228.     public function getToken(): ?string
  229.     {
  230.         return $this->token;
  231.     }
  232.     public function setToken(string $token): self
  233.     {
  234.         $this->token $token;
  235.         return $this;
  236.     }
  237.     public function getAvatarUser(): ?string
  238.     {
  239.         return $this->avatar_user;
  240.     }
  241.     public function setAvatarUser(string $avatar_user): self
  242.     {
  243.         $this->avatar_user $avatar_user;
  244.         return $this;
  245.     }
  246.     public function getThemeUser(): ?string
  247.     {
  248.         return $this->theme_user;
  249.     }
  250.     public function setThemeUser(?string $theme_user): self
  251.     {
  252.         $this->theme_user $theme_user;
  253.         return $this;
  254.     }
  255.     public function getIsActive(): ?bool
  256.     {
  257.         return $this->is_active;
  258.     }
  259.     public function setIsActive(bool $is_active): self
  260.     {
  261.         $this->is_active $is_active;
  262.         return $this;
  263.     }
  264.     public function getTiers(): ?Tiers
  265.     {
  266.         return $this->tiers;
  267.     }
  268.     public function setTiers(?Tiers $tiers): self
  269.     {
  270.         $this->tiers $tiers;
  271.         return $this;
  272.     }
  273.     public function getWorkflowColumnPreferences(): ?array
  274.     {
  275.         return $this->workflow_column_preferences;
  276.     }
  277.     public function setWorkflowColumnPreferences(?array $workflow_column_preferences): self
  278.     {
  279.         $this->workflow_column_preferences $workflow_column_preferences;
  280.         return $this;
  281.     }
  282. }