<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 180, unique: true)]
private $email;
#[ORM\Column(type: 'json')]
private $roles = [];
#[ORM\Column(type: 'string')]
private $password;
#[ORM\Column(type: 'string', length: 45, nullable: true)]
private $last_name;
#[ORM\Column(type: 'string', length: 45, nullable: true)]
private $first_name;
#[ORM\Column(type: 'string', length: 45, nullable: true)]
private $tel;
#[ORM\Column(type: 'string', length: 45, nullable: true)]
private $mobile;
#[ORM\Column(type: 'datetime', nullable: true)]
private $created_at;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updated_at;
#[ORM\Column(type: 'datetime', nullable: true)]
private $deleted_at;
#[ORM\Column(type: 'datetime', nullable: true)]
private $last_cnx_at;
#[ORM\Column(type: 'boolean', nullable: true)]
private $is_verified;
#[ORM\Column(type: 'boolean', nullable: true)]
private $is_main_user;
#[ORM\ManyToOne(targetEntity: Carriers::class, inversedBy: 'carriers_id')]
private $carriers;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Order::class)]
private $orders;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Drivers::class)]
private $drivers;
#[ORM\ManyToOne(targetEntity: Drivers::class, inversedBy: 'users')]
private $driver;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $reset_token;
#[ORM\ManyToOne(targetEntity: RefCountry::class)]
private $ref_country;
#[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: Task::class)]
private Collection $tasks;
#[ORM\Column(type: 'datetime', nullable: true)]
private $last_activity_at = null;
#[ORM\Column]
private ?bool $contact_mailjet = null;
#[ORM\Column(nullable: true)]
private ?int $first_login = null;
#[ORM\Column]
private ?bool $consentement_transmission_geographique = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $idJiraAccount = null;
#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]
private ?bool $is_demo_user = false;
public function __construct()
{
$this->orders = new ArrayCollection();
$this->drivers = new ArrayCollection();
$this->tasks = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
/**
* A visual identifier that represents this user.
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->email;
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
$roles = $this->roles;
return array_unique($roles);
}
public function setRoles(array $roles): self
{
$this->roles = $roles;
return $this;
}
/**
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword(): string
{
return $this->password;
}
public function setPassword(string $password): self
{
$this->password = $password;
return $this;
}
/**
* @see UserInterface
*/
public function eraseCredentials()
{
// If you store any temporary, sensitive data on the user, clear it here
$this->plainPassword = null ;
}
public function getLastName(): ?string
{
return $this->last_name;
}
public function setLastName(?string $last_name): self
{
$this->last_name = $last_name;
return $this;
}
public function getFirstName(): ?string
{
return $this->first_name;
}
public function setFirstName(string $first_name): self
{
$this->first_name = $first_name;
return $this;
}
public function getTel(): ?string
{
return $this->tel;
}
public function setTel(string $tel): self
{
$this->tel = $tel;
return $this;
}
public function getMobile(): ?string
{
return $this->mobile;
}
public function setMobile(string $mobile): self
{
$this->mobile = $mobile;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(?\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(?\DateTimeInterface $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
public function getDeletedAt(): ?\DateTimeInterface
{
return $this->deleted_at;
}
public function setDeletedAt(?\DateTimeInterface $deleted_at): self
{
$this->deleted_at = $deleted_at;
return $this;
}
public function getLastCnxAt(): ?\DateTimeInterface
{
return $this->last_cnx_at;
}
public function setLastCnxAt(?\DateTimeInterface $last_cnx_at): self
{
$this->last_cnx_at = $last_cnx_at;
return $this;
}
public function getIsVerified(): ?bool
{
return $this->is_verified;
}
public function setIsVerified(?bool $is_verified): self
{
$this->is_verified = $is_verified;
return $this;
}
public function getIsMainUser(): ?bool
{
return $this->is_main_user;
}
public function setIsMainUser(?bool $is_main_user): self
{
$this->is_main_user = $is_main_user;
return $this;
}
public function getCarriers(): ?Carriers
{
return $this->carriers;
}
public function setCarriers(?Carriers $carriers): self
{
$this->carriers = $carriers;
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setUser($this);
}
return $this;
}
public function removeOrder(Order $order): self
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getUser() === $this) {
$order->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Drivers>
*/
public function getDrivers(): Collection
{
return $this->drivers;
}
public function addDriver(Drivers $driver): self
{
if (!$this->drivers->contains($driver)) {
$this->drivers[] = $driver;
$driver->setUser($this);
}
return $this;
}
public function removeDriver(Drivers $driver): self
{
if ($this->drivers->removeElement($driver)) {
// set the owning side to null (unless already changed)
if ($driver->getUser() === $this) {
$driver->setUser(null);
}
}
return $this;
}
public function getDriver(): ?Drivers
{
return $this->driver;
}
public function setDriver(?Drivers $driver): self
{
$this->driver = $driver;
return $this;
}
public function getResetToken(): ?string
{
return $this->reset_token;
}
public function setResetToken(?string $reset_token): self
{
$this->reset_token = $reset_token;
return $this;
}
public function getRefCountry(): ?RefCountry
{
return $this->ref_country;
}
public function setRefCountry(?RefCountry $ref_country): self
{
$this->ref_country = $ref_country;
return $this;
}
/**
* @return Collection<int, Task>
*/
public function getTasks(): Collection
{
return $this->tasks;
}
public function addTask(Task $task): static
{
if (!$this->tasks->contains($task)) {
$this->tasks->add($task);
$task->setCreatedBy($this);
}
return $this;
}
public function removeTask(Task $task): static
{
if ($this->tasks->removeElement($task)) {
// set the owning side to null (unless already changed)
if ($task->getCreatedBy() === $this) {
$task->setCreatedBy(null);
}
}
return $this;
}
public function getLastActivityAt(): ?\DateTimeInterface
{
return $this->last_activity_at;
}
public function setLastActivityAt(?\DateTimeInterface $last_activity_at): static
{
$this->last_activity_at = $last_activity_at;
return $this;
}
public function isContactMailjet(): ?bool
{
return $this->contact_mailjet;
}
public function setContactMailjet(bool $contact_mailjet): static
{
$this->contact_mailjet = $contact_mailjet;
return $this;
}
public function getFirstLogin(): ?int
{
return $this->first_login;
}
public function setFirstLogin(?int $first_login): static
{
$this->first_login = $first_login;
return $this;
}
public function isConsentementTransmissionGeographique(): ?bool
{
return $this->consentement_transmission_geographique;
}
public function setConsentementTransmissionGeographique(bool $consentement_transmission_geographique): static
{
$this->consentement_transmission_geographique = $consentement_transmission_geographique;
return $this;
}
public function getIdJiraAccount(): ?string
{
return $this->idJiraAccount;
}
public function setIdJiraAccount(?string $idJiraAccount): static
{
$this->idJiraAccount = $idJiraAccount;
return $this;
}
public function isIsDemoUser(): ?bool
{
return $this->is_demo_user;
}
public function setIsDemoUser(bool $is_demo_user): static
{
$this->is_demo_user = $is_demo_user;
return $this;
}
}