<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @ORM\Entity(repositoryClass=UserRepository::class)
* @UniqueEntity(fields={"email"}, message="There is already an account with this email")
*/
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=110, nullable=true)
*/
private $name;
/**
* @ORM\Column(type="string", length=180, unique=true)
*/
private $email;
/**
* @ORM\Column(type="json")
*/
private $roles = [];
/**
* @var string The hashed password
* @ORM\Column(type="string")
*/
private $password;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $mobile;
/**
* @ORM\Column(type="string", length=110, nullable=true)
*/
private $country_id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Dsccountries", cascade={"persist"})
*/
private $country;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\City", cascade={"persist"})
*/
private $city;
// *
// * @ORM\ManyToOne(targetEntity="App\Entity\Province", cascade={"persist"})
// private $province;
/**
* @ORM\Column(type="string", length=110, nullable=true)
*/
private $province_id;
/**
* @ORM\Column(type="string", length=110, nullable=true)
*/
private $city_id;
/**
* @ORM\Column(type="string", length=110, nullable=true)
*/
private $agentgroup_id;
/**
* @ORM\Column(type="integer", length=11)
*/
private $added_by;
/**
* @ORM\Column(type="integer", length=11, nullable=false)
*/
private $status;
/**
* @ORM\Column(type="string", nullable=false)
*/
private $type;
/**
* @ORM\Column(type="string",length=110, nullable=true)
*/
private $rolebyadmin;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $image;
/**
* @ORM\Column(type="string", length=110, nullable=true)
*/
private $ipaddress;
/**
* @ORM\Column(type="string", length=110, nullable=true)
*/
private $lang;
/**
* @ORM\Column(type="string", length=110, nullable=true)
*/
private $user_id;
/**
* @ORM\Column(type="boolean")
*/
private $isVerified = false;
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;
}
/**
* @deprecated since Symfony 5.3, use getUserIdentifier instead
*/
public function getUsername(): string
{
return (string) $this->email;
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';
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;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getMobile(): ?string
{
return $this->mobile;
}
public function setMobile(?string $mobile): self
{
$this->mobile = $mobile;
return $this;
}
public function getCountryId(): ?string
{
return $this->country_id;
}
public function setCountryId(string $country_id): self
{
$this->country_id = $country_id;
return $this;
}
public function getCityId(): ?string
{
return $this->city_id;
}
public function setCityId(string $city_id): self
{
$this->city_id = $city_id;
return $this;
}
public function getProvinceId(): ?string
{
return $this->province_id;
}
public function setProvinceId(?string $province_id): self
{
$this->province_id = $province_id;
return $this;
}
public function getAgentgroupId(): ?string
{
return $this->agentgroup_id;
}
public function setAgentgroupId(?string $agentgroup_id): self
{
$this->agentgroup_id = $agentgroup_id;
return $this;
}
public function getAddedBy(): ?string
{
return $this->added_by;
}
public function setAddedBy(string $added_by): self
{
$this->added_by = $added_by;
return $this;
}
public function getRolebyadmin(): ?string
{
return $this->rolebyadmin;
}
public function setRolebyadmin(?string $rolebyadmin): self
{
$this->rolebyadmin = $rolebyadmin;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(string $image): self
{
$this->image = $image;
return $this;
}
public function getIpaddress(): ?string
{
return $this->ipaddress;
}
public function setIpaddress(string $ipaddress): self
{
$this->ipaddress = $ipaddress;
return $this;
}
public function getLang(): ?string
{
return $this->lang;
}
public function setLang(string $lang): self
{
$this->lang = $lang;
return $this;
}
public function getUserId(): ?string
{
return $this->user_id;
}
public function setUserId(string $user_id): self
{
$this->user_id = $user_id;
return $this;
}
public function setCountry(\App\Entity\Dsccountries $country = null)
{
$this->country = $country;
return $this;
}
public function getCountry()
{
return $this->country;
}
public function setCity(\App\Entity\City $city = null)
{
$this->city = $city;
return $this;
}
public function getCity()
{
return $this->city;
}
// public function setProvince(\App\Entity\Province $province = null)
// {
// $this->province = $province;
// return $this;
// }
// public function getProvince()
// {
// return $this->province;
// }
/**
* Returning a salt is only needed, if you are not using a modern
* hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
*
* @see UserInterface
*/
public function getSalt(): ?string
{
return null;
}
/**
* @see UserInterface
*/
public function eraseCredentials()
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public function isVerified(): bool
{
return $this->isVerified;
}
public function setIsVerified(bool $isVerified): self
{
$this->isVerified = $isVerified;
return $this;
}
/**
* @var string The hashed passwordResetToken
* @ORM\Column(type="string")
*/
private $passwordResetToken;
public function getPasswordResetToken(): string
{
return (string) $this->passwordResetToken;
}
public function setPasswordResetToken(string $passwordResetToken): self
{
$this->passwordResetToken = $passwordResetToken;
return $this;
}
}