src/Entity/User.php line 172

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  9. use Symfony\Component\Security\Core\User\UserInterface;
  10. #[ORM\Entity(repositoryClass: UserRepository::class)]
  11. class User implements UserInterface, PasswordAuthenticatedUserInterface
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column(type: 'integer')]
  16.     private $id;
  17.     #[ORM\Column(type: 'string', length: 180, unique: true)]
  18.     private $email;
  19.     #[ORM\Column(type: 'json')]
  20.     private $roles = [];
  21.     #[ORM\Column(type: 'string')]
  22.     private $password;
  23.     #[ORM\Column(type: 'string', length: 45, nullable: true)]
  24.     private $last_name;
  25.     #[ORM\Column(type: 'string', length: 45, nullable: true)]
  26.     private $first_name;
  27.     #[ORM\Column(type: 'string', length: 45, nullable: true)]
  28.     private $tel;
  29.     #[ORM\Column(type: 'string', length: 45, nullable: true)]
  30.     private $mobile;
  31.     #[ORM\Column(type: 'datetime', nullable: true)]
  32.     private $created_at;
  33.     #[ORM\Column(type: 'datetime', nullable: true)]
  34.     private $updated_at;
  35.     #[ORM\Column(type: 'datetime', nullable: true)]
  36.     private $deleted_at;
  37.     #[ORM\Column(type: 'datetime', nullable: true)]
  38.     private $last_cnx_at;
  39.     #[ORM\Column(type: 'boolean', nullable: true)]
  40.     private $is_verified;
  41.     #[ORM\Column(type: 'boolean', nullable: true)]
  42.     private $is_main_user;
  43.     #[ORM\ManyToOne(targetEntity: Carriers::class, inversedBy: 'carriers_id')]
  44.     private $carriers;
  45.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: Order::class)]
  46.     private $orders;
  47.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: Drivers::class)]
  48.     private $drivers;
  49.     #[ORM\ManyToOne(targetEntity: Drivers::class, inversedBy: 'users')]
  50.     private $driver;
  51.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  52.     private $reset_token;
  53.     #[ORM\ManyToOne(targetEntity: RefCountry::class)]
  54.     private $ref_country;
  55.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: Task::class)]
  56.     private Collection $tasks;
  57.     #[ORM\Column(type: 'datetime', nullable: true)]
  58.     private $last_activity_at = null;
  59.     #[ORM\Column]
  60.     private ?bool $contact_mailjet = null;
  61.     #[ORM\Column(nullable: true)]
  62.     private ?int $first_login = null;
  63.     #[ORM\Column]
  64.     private ?bool $consentement_transmission_geographique = null;
  65.     #[ORM\Column(length: 255, nullable: true)]
  66.     private ?string $idJiraAccount = null;
  67.     #[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]
  68.     private ?bool $is_demo_user = false;
  69.     public function __construct()
  70.     {
  71.         $this->orders = new ArrayCollection();
  72.         $this->drivers = new ArrayCollection();
  73.         $this->tasks = new ArrayCollection();
  74.     }
  75.     public function getId(): ?int
  76.     {
  77.         return $this->id;
  78.     }
  79.     public function getEmail(): ?string
  80.     {
  81.         return $this->email;
  82.     }
  83.     public function setEmail(string $email): self
  84.     {
  85.         $this->email = $email;
  86.         return $this;
  87.     }
  88.     /**
  89.      * A visual identifier that represents this user.
  90.      *
  91.      * @see UserInterface
  92.      */
  93.     public function getUserIdentifier(): string
  94.     {
  95.         return (string) $this->email;
  96.     }
  97.     /**
  98.      * @see UserInterface
  99.      */
  100.     public function getRoles(): array
  101.     {
  102.         $roles = $this->roles;
  103.         return array_unique($roles);
  104.     }
  105.     public function setRoles(array $roles): self
  106.     {
  107.         $this->roles = $roles;
  108.         return $this;
  109.     }
  110.     /**
  111.      * @see PasswordAuthenticatedUserInterface
  112.      */
  113.     public function getPassword(): string
  114.     {
  115.         return $this->password;
  116.     }
  117.     public function setPassword(string $password): self
  118.     {
  119.         $this->password = $password;
  120.         return $this;
  121.     }
  122.     /**
  123.      * @see UserInterface
  124.      */
  125.     public function eraseCredentials()
  126.     {
  127.         // If you store any temporary, sensitive data on the user, clear it here
  128.         $this->plainPassword = null ;
  129.       
  130.           
  131.         
  132.     }
  133.     public function getLastName(): ?string
  134.     {
  135.         return $this->last_name;
  136.     }
  137.     public function setLastName(?string $last_name): self
  138.     {
  139.         $this->last_name = $last_name;
  140.         return $this;
  141.     }
  142.     public function getFirstName(): ?string
  143.     {
  144.         return $this->first_name;
  145.     }
  146.     public function setFirstName(string $first_name): self
  147.     {
  148.         $this->first_name = $first_name;
  149.         return $this;
  150.     }
  151.     public function getTel(): ?string
  152.     {
  153.         return $this->tel;
  154.     }
  155.     public function setTel(string $tel): self
  156.     {
  157.         $this->tel = $tel;
  158.         return $this;
  159.     }
  160.     public function getMobile(): ?string
  161.     {
  162.         return $this->mobile;
  163.     }
  164.     public function setMobile(string $mobile): self
  165.     {
  166.         $this->mobile = $mobile;
  167.         return $this;
  168.     }
  169.     public function getCreatedAt(): ?\DateTimeInterface
  170.     {
  171.         return $this->created_at;
  172.     }
  173.     public function setCreatedAt(?\DateTimeInterface $created_at): self
  174.     {
  175.         $this->created_at = $created_at;
  176.         return $this;
  177.     }
  178.     public function getUpdatedAt(): ?\DateTimeInterface
  179.     {
  180.         return $this->updated_at;
  181.     }
  182.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  183.     {
  184.         $this->updated_at = $updated_at;
  185.         return $this;
  186.     }
  187.     public function getDeletedAt(): ?\DateTimeInterface
  188.     {
  189.         return $this->deleted_at;
  190.     }
  191.     public function setDeletedAt(?\DateTimeInterface $deleted_at): self
  192.     {
  193.         $this->deleted_at = $deleted_at;
  194.         return $this;
  195.     }
  196.     public function getLastCnxAt(): ?\DateTimeInterface
  197.     {
  198.         return $this->last_cnx_at;
  199.     }
  200.     public function setLastCnxAt(?\DateTimeInterface $last_cnx_at): self
  201.     {
  202.         $this->last_cnx_at = $last_cnx_at;
  203.         return $this;
  204.     }
  205.     public function getIsVerified(): ?bool
  206.     {
  207.         return $this->is_verified;
  208.     }
  209.     public function setIsVerified(?bool $is_verified): self
  210.     {
  211.         $this->is_verified = $is_verified;
  212.         return $this;
  213.     }
  214.     public function getIsMainUser(): ?bool
  215.     {
  216.         return $this->is_main_user;
  217.     }
  218.     public function setIsMainUser(?bool $is_main_user): self
  219.     {
  220.         $this->is_main_user = $is_main_user;
  221.         return $this;
  222.     }
  223.     public function getCarriers(): ?Carriers
  224.     {
  225.         return $this->carriers;
  226.     }
  227.     public function setCarriers(?Carriers $carriers): self
  228.     {
  229.         $this->carriers = $carriers;
  230.         return $this;
  231.     }
  232.     /**
  233.      * @return Collection<int, Order>
  234.      */
  235.     public function getOrders(): Collection
  236.     {
  237.         return $this->orders;
  238.     }
  239.     public function addOrder(Order $order): self
  240.     {
  241.         if (!$this->orders->contains($order)) {
  242.             $this->orders[] = $order;
  243.             $order->setUser($this);
  244.         }
  245.         return $this;
  246.     }
  247.     public function removeOrder(Order $order): self
  248.     {
  249.         if ($this->orders->removeElement($order)) {
  250.             // set the owning side to null (unless already changed)
  251.             if ($order->getUser() === $this) {
  252.                 $order->setUser(null);
  253.             }
  254.         }
  255.         return $this;
  256.     }
  257.     /**
  258.      * @return Collection<int, Drivers>
  259.      */
  260.     public function getDrivers(): Collection
  261.     {
  262.         return $this->drivers;
  263.     }
  264.     public function addDriver(Drivers $driver): self
  265.     {
  266.         if (!$this->drivers->contains($driver)) {
  267.             $this->drivers[] = $driver;
  268.             $driver->setUser($this);
  269.         }
  270.         return $this;
  271.     }
  272.     public function removeDriver(Drivers $driver): self
  273.     {
  274.         if ($this->drivers->removeElement($driver)) {
  275.             // set the owning side to null (unless already changed)
  276.             if ($driver->getUser() === $this) {
  277.                 $driver->setUser(null);
  278.             }
  279.         }
  280.         return $this;
  281.     }
  282.     public function getDriver(): ?Drivers
  283.     {
  284.         return $this->driver;
  285.     }
  286.     public function setDriver(?Drivers $driver): self
  287.     {
  288.         $this->driver = $driver;
  289.         return $this;
  290.     }
  291.     public function getResetToken(): ?string
  292.     {
  293.         return $this->reset_token;
  294.     }
  295.     public function setResetToken(?string $reset_token): self
  296.     {
  297.         $this->reset_token = $reset_token;
  298.         return $this;
  299.     }
  300.     public function getRefCountry(): ?RefCountry
  301.     {
  302.         return $this->ref_country;
  303.     }
  304.     public function setRefCountry(?RefCountry $ref_country): self
  305.     {
  306.         $this->ref_country = $ref_country;
  307.         return $this;
  308.     }
  309.     /**
  310.      * @return Collection<int, Task>
  311.      */
  312.     public function getTasks(): Collection
  313.     {
  314.         return $this->tasks;
  315.     }
  316.     public function addTask(Task $task): static
  317.     {
  318.         if (!$this->tasks->contains($task)) {
  319.             $this->tasks->add($task);
  320.             $task->setCreatedBy($this);
  321.         }
  322.         return $this;
  323.     }
  324.     public function removeTask(Task $task): static
  325.     {
  326.         if ($this->tasks->removeElement($task)) {
  327.             // set the owning side to null (unless already changed)
  328.             if ($task->getCreatedBy() === $this) {
  329.                 $task->setCreatedBy(null);
  330.             }
  331.         }
  332.         return $this;
  333.     }
  334.     public function getLastActivityAt(): ?\DateTimeInterface
  335.     {
  336.         return $this->last_activity_at;
  337.     }
  338.     public function setLastActivityAt(?\DateTimeInterface $last_activity_at): static
  339.     {
  340.         $this->last_activity_at = $last_activity_at;
  341.         return $this;
  342.     }
  343.     public function isContactMailjet(): ?bool
  344.     {
  345.         return $this->contact_mailjet;
  346.     }
  347.     public function setContactMailjet(bool $contact_mailjet): static
  348.     {
  349.         $this->contact_mailjet = $contact_mailjet;
  350.         return $this;
  351.     }
  352.     public function getFirstLogin(): ?int
  353.     {
  354.         return $this->first_login;
  355.     }
  356.     public function setFirstLogin(?int $first_login): static
  357.     {
  358.         $this->first_login = $first_login;
  359.         return $this;
  360.     }
  361.     public function isConsentementTransmissionGeographique(): ?bool
  362.     {
  363.         return $this->consentement_transmission_geographique;
  364.     }
  365.     public function setConsentementTransmissionGeographique(bool $consentement_transmission_geographique): static
  366.     {
  367.         $this->consentement_transmission_geographique = $consentement_transmission_geographique;
  368.         return $this;
  369.     }
  370.     public function getIdJiraAccount(): ?string
  371.     {
  372.         return $this->idJiraAccount;
  373.     }
  374.     public function setIdJiraAccount(?string $idJiraAccount): static
  375.     {
  376.         $this->idJiraAccount = $idJiraAccount;
  377.         return $this;
  378.     }
  379.     public function isIsDemoUser(): ?bool
  380.     {
  381.         return $this->is_demo_user;
  382.     }
  383.     public function setIsDemoUser(bool $is_demo_user): static
  384.     {
  385.         $this->is_demo_user = $is_demo_user;
  386.         return $this;
  387.     }
  388. }