src/Entity/User.php line 29

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\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  7. use Symfony\Component\Security\Core\User\UserInterface;
  8. /**
  9.  * @ORM\Entity(repositoryClass=UserRepository::class)
  10.  * @UniqueEntity(fields={"email"}, message="There is already an account with this email")
  11.  */
  12. class User 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=110, nullable=true)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @ORM\Column(type="string", length=180, unique=true)
  26.      */
  27.     private $email;
  28.     /**
  29.      * @ORM\Column(type="json")
  30.      */
  31.     private $roles = [];
  32.     /**
  33.      * @var string The hashed password
  34.      * @ORM\Column(type="string")
  35.      */
  36.     private $password;
  37.     /**
  38.      * @ORM\Column(type="string", length=10, nullable=true)
  39.      */
  40.     private $mobile;
  41.     /**
  42.      * @ORM\Column(type="string", length=110, nullable=true)
  43.      */
  44.     private $country_id;
  45.     /**
  46.      * @ORM\ManyToOne(targetEntity="App\Entity\Dsccountries", cascade={"persist"})
  47.      */
  48.     private $country;
  49.     /**
  50.      * @ORM\ManyToOne(targetEntity="App\Entity\City", cascade={"persist"})
  51.      */
  52.     private $city;
  53.     // *
  54.     //  * @ORM\ManyToOne(targetEntity="App\Entity\Province", cascade={"persist"})
  55.      
  56.     // private $province;
  57.     /**
  58.      * @ORM\Column(type="string", length=110, nullable=true)
  59.      */
  60.     private $province_id;
  61.     /**
  62.      * @ORM\Column(type="string", length=110, nullable=true)
  63.      */
  64.     private $city_id;
  65.     /**
  66.      * @ORM\Column(type="string", length=110, nullable=true)
  67.      */
  68.     private $agentgroup_id;
  69.     /**
  70.      * @ORM\Column(type="integer", length=11)
  71.      */
  72.     private $added_by;
  73.     
  74.     /**
  75.      * @ORM\Column(type="integer", length=11, nullable=false)
  76.      */
  77.     private $status;
  78.     
  79.     /**
  80.      * @ORM\Column(type="string", nullable=false)
  81.      */
  82.     private $type;
  83.     
  84.     /**
  85.      * @ORM\Column(type="string",length=110, nullable=true)
  86.      */
  87.     private $rolebyadmin;
  88.     
  89.     /**
  90.      * @ORM\Column(type="string", length=255, nullable=true)
  91.      */
  92.     private $image;
  93.     
  94.     /**
  95.      * @ORM\Column(type="string", length=110, nullable=true)
  96.      */
  97.     private $ipaddress;
  98.     /**
  99.      * @ORM\Column(type="string", length=110, nullable=true)
  100.      */
  101.     private $lang;
  102.     
  103.     /**
  104.      * @ORM\Column(type="string", length=110, nullable=true)
  105.      */
  106.     private $user_id;
  107.     /**
  108.      * @ORM\Column(type="boolean")
  109.      */
  110.     private $isVerified false;
  111.     public function getId(): ?int
  112.     {
  113.         return $this->id;
  114.     }
  115.     public function getEmail(): ?string
  116.     {
  117.         return $this->email;
  118.     }
  119.     public function setEmail(string $email): self
  120.     {
  121.         $this->email $email;
  122.         return $this;
  123.     }
  124.     /**
  125.      * A visual identifier that represents this user.
  126.      *
  127.      * @see UserInterface
  128.      */
  129.     public function getUserIdentifier(): string
  130.     {
  131.         return (string) $this->email;
  132.     }
  133.     /**
  134.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  135.      */
  136.     public function getUsername(): string
  137.     {
  138.         return (string) $this->email;
  139.     }
  140.     /**
  141.      * @see UserInterface
  142.      */
  143.     public function getRoles(): array
  144.     {
  145.         $roles $this->roles;
  146.         // guarantee every user at least has ROLE_USER
  147.         $roles[] = 'ROLE_USER';
  148.         return array_unique($roles);
  149.     }
  150.     public function setRoles(array $roles): self
  151.     {
  152.         $this->roles $roles;
  153.         return $this;
  154.     }
  155.     /**
  156.      * @see PasswordAuthenticatedUserInterface
  157.      */
  158.     public function getPassword(): string
  159.     {
  160.         return $this->password;
  161.     }
  162.     public function setPassword(string $password): self
  163.     {
  164.         $this->password $password;
  165.         return $this;
  166.     }
  167.     public function getName(): ?string
  168.     {
  169.         return $this->name;
  170.     }
  171.     public function setName(string $name): self
  172.     {
  173.         $this->name $name;
  174.         return $this;
  175.     }
  176.     
  177.     public function getMobile(): ?string
  178.     {
  179.         return $this->mobile;
  180.     }
  181.     public function setMobile(?string $mobile): self
  182.     {
  183.         $this->mobile $mobile;
  184.         return $this;
  185.     }
  186.     
  187.     public function getCountryId(): ?string
  188.     {
  189.         return $this->country_id;
  190.     }
  191.     public function setCountryId(string $country_id): self
  192.     {
  193.         $this->country_id $country_id;
  194.         return $this;
  195.     }
  196.     
  197.     public function getCityId(): ?string
  198.     {
  199.         return $this->city_id;
  200.     }
  201.     public function setCityId(string $city_id): self
  202.     {
  203.         $this->city_id $city_id;
  204.         return $this;
  205.     }
  206.     public function getProvinceId(): ?string
  207.     {
  208.         return $this->province_id;
  209.     }
  210.     public function setProvinceId(?string $province_id): self
  211.     {
  212.         $this->province_id $province_id;
  213.         return $this;
  214.     }
  215.     public function getAgentgroupId(): ?string
  216.     {
  217.         return $this->agentgroup_id;
  218.     }
  219.     public function setAgentgroupId(?string $agentgroup_id): self
  220.     {
  221.         $this->agentgroup_id $agentgroup_id;
  222.         return $this;
  223.     }
  224.     
  225.     public function getAddedBy(): ?string
  226.     {
  227.         return $this->added_by;
  228.     }
  229.     public function setAddedBy(string $added_by): self
  230.     {
  231.         $this->added_by $added_by;
  232.         return $this;
  233.     }
  234.     
  235.     public function getRolebyadmin(): ?string
  236.     {
  237.         return $this->rolebyadmin;
  238.     }
  239.     public function setRolebyadmin(?string $rolebyadmin): self
  240.     {
  241.         $this->rolebyadmin $rolebyadmin;
  242.         return $this;
  243.     }
  244.     
  245.     public function getStatus(): ?string
  246.     {
  247.         return $this->status;
  248.     }
  249.     public function setStatus(string $status): self
  250.     {
  251.         $this->status $status;
  252.         return $this;
  253.     }
  254.     
  255.     public function getType(): ?string
  256.     {
  257.         return $this->type;
  258.     }
  259.     public function setType(string $type): self
  260.     {
  261.         $this->type $type;
  262.         return $this;
  263.     }
  264.     
  265.     public function getImage(): ?string
  266.     {
  267.         return $this->image;
  268.     }
  269.     public function setImage(string $image): self
  270.     {
  271.         $this->image $image;
  272.         return $this;
  273.     }
  274.     
  275.     public function getIpaddress(): ?string
  276.     {
  277.         return $this->ipaddress;
  278.     }
  279.     public function setIpaddress(string $ipaddress): self
  280.     {
  281.         $this->ipaddress $ipaddress;
  282.         return $this;
  283.     }
  284.     public function getLang(): ?string
  285.     {
  286.         return $this->lang;
  287.     }
  288.     public function setLang(string $lang): self
  289.     {
  290.         $this->lang $lang;
  291.         return $this;
  292.     }
  293.     
  294.     public function getUserId(): ?string
  295.     {
  296.         return $this->user_id;
  297.     }
  298.     public function setUserId(string $user_id): self
  299.     {
  300.         $this->user_id $user_id;
  301.         return $this;
  302.     }
  303.     
  304.     public function setCountry(\App\Entity\Dsccountries $country null)
  305.     {
  306.         $this->country $country;
  307.         return $this;
  308.     }
  309.     public function getCountry()
  310.     {
  311.         return $this->country;
  312.     }
  313.     public function setCity(\App\Entity\City $city null)
  314.     {
  315.         $this->city $city;
  316.         return $this;
  317.     }
  318.     public function getCity()
  319.     {
  320.         return $this->city;
  321.     }
  322.     // public function setProvince(\App\Entity\Province $province = null)
  323.     // {
  324.     //     $this->province = $province;
  325.     //     return $this;
  326.     // }
  327.     // public function getProvince()
  328.     // {
  329.     //     return $this->province;
  330.     // }
  331.     /**
  332.      * Returning a salt is only needed, if you are not using a modern
  333.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  334.      *
  335.      * @see UserInterface
  336.      */
  337.     public function getSalt(): ?string
  338.     {
  339.         return null;
  340.     }
  341.     /**
  342.      * @see UserInterface
  343.      */
  344.     public function eraseCredentials()
  345.     {
  346.         // If you store any temporary, sensitive data on the user, clear it here
  347.         // $this->plainPassword = null;
  348.     }
  349.     public function isVerified(): bool
  350.     {
  351.         return $this->isVerified;
  352.     }
  353.     public function setIsVerified(bool $isVerified): self
  354.     {
  355.         $this->isVerified $isVerified;
  356.         return $this;
  357.     }
  358.     /**
  359.      * @var string The hashed passwordResetToken
  360.      * @ORM\Column(type="string")
  361.      */
  362.     private $passwordResetToken;
  363.     public function getPasswordResetToken(): string
  364.     {
  365.         return (string) $this->passwordResetToken;
  366.     }
  367.     public function setPasswordResetToken(string $passwordResetToken): self
  368.     {
  369.         $this->passwordResetToken $passwordResetToken;
  370.         return $this;
  371.     }
  372. }