src/Entity/Admin.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Security\Core\User\UserInterface;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. /**
  7.  * User
  8.  *
  9.  * @ORM\Entity
  10.  */
  11. class Admin implements UserInterface
  12. {
  13.     /**
  14.      * @var int
  15.      *
  16.      * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue(strategy="IDENTITY")
  19.      */
  20.     private $id;
  21.     private $fullName;
  22.     /**
  23.      * @ORM\Column(type="string", length=50, nullable=true)
  24.      * @Groups("api_login")
  25.      */
  26.     private $country;
  27.     /**
  28.      * @ORM\Column(type="integer", nullable=true)
  29.      */
  30.     private $verificationCode;
  31.     /**
  32.      * @var array|null
  33.      *
  34.      * @ORM\Column(name="roles", type="json", nullable=true)
  35.      */
  36.     private $roles;
  37.      /**
  38.      * @ORM\Column(type="datetime", nullable=true)
  39.      * @Groups("api_login")
  40.      */
  41.     private $createdAt;
  42.     /**
  43.      * @ORM\Column(type="datetime", nullable=true)
  44.      */
  45.     private $birthday;
  46.     /**
  47.      * @ORM\Column(type="string", length=50, nullable=true)
  48.      */
  49.     private $gender;
  50.     /**
  51.      *@ORM\Column(type="boolean", options={"default":"0"}, nullable=true)
  52.      */
  53.     private $isDeleted;
  54.     /**
  55.      * @ORM\Column(type="datetime", nullable=true)
  56.      */
  57.     private $deletedAt;
  58.     /**
  59.      * @var string|null
  60.      *
  61.      * @ORM\Column(name="email", type="string", length=190, nullable=true)
  62.      */
  63.     private $email;
  64.     /**
  65.      * @var string|null
  66.      *
  67.      * @ORM\Column(name="password", type="string", length=190, nullable=true)
  68.      */
  69.     private $password;
  70.     /**
  71.      * @ORM\Column(type="string", length=255, nullable=true)
  72.      */
  73.     private $first_name;
  74.     /**
  75.      * @ORM\Column(type="string", length=255, nullable=true)
  76.      */
  77.     private $last_name;
  78.     public function getId(): ?int
  79.     {
  80.         return $this->id;
  81.     }
  82.    /**
  83.      * @return mixed
  84.      * @Groups("api_login")
  85.      */
  86.     public function getCountry()
  87.     {
  88.         return $this->country;
  89.     }
  90.     /**
  91.      * @param string $country
  92.      */
  93.     public function setCountry($country): void
  94.     {
  95.         $this->country $country;
  96.     }
  97.     /**
  98.      * @return string
  99.      */
  100.     public function getEmail()
  101.     {
  102.         return $this->email;
  103.     }
  104.     public function setEmail($email)
  105.     {
  106.         $this->email $email;
  107.     }
  108.     /**
  109.      * @return string
  110.      */
  111.     public function getFullName()
  112.     {
  113.         return $this->fullName;
  114.     }
  115.     /**
  116.      * @param string $fullName
  117.      */
  118.     public function setFullName($fullName): void
  119.     {
  120.         $this->fullName $fullName;
  121.     }
  122.     public function __toString()
  123.     {
  124.         $str ''.$this->getFullName();
  125.         if (empty($str)) {
  126.             $str $this->getEmail();
  127.         }
  128.         return $str;
  129.     }
  130.     /**
  131.      * @return \DateTime
  132.      */
  133.     public function getBirthday()
  134.     {
  135.         return $this->birthday;
  136.     }
  137.     /**
  138.      * @param  \DateTime $birthday
  139.      */
  140.     public function setBirthday(\DateTime $birthday): void
  141.     {
  142.         $this->birthday $birthday;
  143.     }
  144.     /**
  145.      * @return String
  146.      */
  147.     public function getGender()
  148.     {
  149.         return $this->gender;
  150.     }
  151.     /**
  152.      * @param string $gender
  153.      */
  154.     public function setGender(String $gender): void
  155.     {
  156.         $this->gender $gender;
  157.     }
  158.   /**
  159.      * @return \DateTime
  160.      *
  161.      */
  162.     public function getCreatedAt()
  163.     {
  164.         return $this->createdAt;
  165.     }
  166.     /**
  167.      * @param mixed $createdAt
  168.      */
  169.     public function setCreatedAt($createdAt): void
  170.     {
  171.         $this->createdAt $createdAt;
  172.     }
  173.     /**
  174.      * @return bool
  175.      */
  176.     public function getDeleted()
  177.     {
  178.         return $this->isDeleted;
  179.     }
  180.     /**
  181.      * @param bool $deleted
  182.      */
  183.     public function setDeleted(bool $deleted): void
  184.     {
  185.         $this->isDeleted $deleted;
  186.     }
  187.     /**
  188.      * @return \DateTime
  189.      */
  190.     public function getDeletedAt()
  191.     {
  192.         return $this->deletedAt;
  193.     }
  194.     /**
  195.      * @param  \DateTime $deletedAt
  196.      */    public function setDeletedAt(\DateTime $deletedAt): void
  197.     {
  198.         $this->deletedAt $deletedAt;
  199.     }
  200.     public function getVerificationCode(): ?int
  201.     {
  202.         return $this->verificationCode;
  203.     }
  204.     public function setVerificationCode(?int $verificationCode): self
  205.     {
  206.         $this->verificationCode $verificationCode;
  207.         return $this;
  208.     }
  209.     /**
  210.      * @return mixed
  211.      */
  212.     public function getIsDeleted()
  213.     {
  214.         return $this->isDeleted;
  215.     }
  216.     /**
  217.      * @param mixed $isDeleted
  218.      */
  219.     public function setIsDeleted($isDeleted): void
  220.     {
  221.         $this->isDeleted $isDeleted;
  222.     }
  223.     public function getPassword(): ?string
  224.     {
  225.         return $this->password;
  226.     }
  227.     public function setPassword(?string $password): void
  228.     {
  229.         $this->password $password;
  230.     }
  231.     public function getSalt()
  232.     {
  233.         // TODO: Implement getSalt() method.
  234.     }
  235.     public function eraseCredentials()
  236.     {
  237.         // TODO: Implement eraseCredentials() method.
  238.     }
  239.     public function getUsername()
  240.     {
  241.         return $this->email;
  242.     }
  243.     public function getRoles(): ?array
  244.     {
  245.         return $this->roles;
  246.     }
  247.     public function setRoles(?array $roles): void
  248.     {
  249.         $this->roles $roles;
  250.     }
  251.     public function getFirstName(): ?string
  252.     {
  253.         return $this->first_name;
  254.     }
  255.     public function setFirstName(?string $first_name): self
  256.     {
  257.         $this->first_name $first_name;
  258.         return $this;
  259.     }
  260.     public function getLastName(): ?string
  261.     {
  262.         return $this->last_name;
  263.     }
  264.     public function setLastName(?string $last_name): self
  265.     {
  266.         $this->last_name $last_name;
  267.         return $this;
  268.     }
  269. }