src/Entity/Agents.php line 12

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. /**
  6. * @ORM\Entity(repositoryClass="App\Repository\AgentsRepository")
  7. * @ORM\Table(indexes={@ORM\Index(name="email", columns={"email"})})
  8. */
  9. class Agents implements UserInterface, \Serializable
  10. {
  11. /**
  12. * @ORM\Column(type="integer")
  13. * @ORM\Id
  14. * @ORM\GeneratedValue(strategy="AUTO")
  15. */
  16. private $id;
  17. /**
  18. * @ORM\Column(type="string", length=25)
  19. */
  20. private $username;
  21. /**
  22. * @ORM\Column(type="string", length=64)
  23. */
  24. private $password;
  25. /**
  26. * @ORM\Column(type="string", length=254, unique=true)
  27. */
  28. private $email;
  29. /**
  30. * @ORM\Column(name="is_active", type="boolean")
  31. */
  32. private $isActive = true;
  33. /**
  34. * @ORM\Column(type="datetime", nullable=true)
  35. */
  36. private $dateUpdated;
  37. /**
  38. * @ORM\Column(type="datetime", nullable=true)
  39. */
  40. private $dateInserted;
  41. public function __construct()
  42. {
  43. // $this->isActive = true;
  44. // may not be needed, see section on salt below
  45. // $this->salt = md5(uniqid('', true));
  46. }
  47. public function getUsername()
  48. {
  49. return $this->username;
  50. }
  51. public function getSalt()
  52. {
  53. // you *may* need a real salt depending on your encoder
  54. // see section on salt below
  55. return null;
  56. }
  57. public function getPassword()
  58. {
  59. return $this->password;
  60. }
  61. public function getRoles()
  62. {
  63. return array('ROLE_AGENT');
  64. }
  65. public function eraseCredentials()
  66. {
  67. }
  68. /** @see \Serializable::serialize() */
  69. public function serialize()
  70. {
  71. return serialize(array(
  72. $this->id,
  73. $this->username,
  74. $this->password,
  75. // see section on salt below
  76. // $this->salt,
  77. ));
  78. }
  79. /** @see \Serializable::unserialize() */
  80. public function unserialize($serialized)
  81. {
  82. list (
  83. $this->id,
  84. $this->username,
  85. $this->password,
  86. // see section on salt below
  87. // $this->salt
  88. ) = unserialize($serialized, array('allowed_classes' => false));
  89. }
  90. /**
  91. * Get id.
  92. *
  93. * @return int
  94. */
  95. public function getId()
  96. {
  97. return $this->id;
  98. }
  99. /**
  100. * Set username.
  101. *
  102. * @param string $username
  103. *
  104. * @return Agents
  105. */
  106. public function setUsername($username)
  107. {
  108. $this->username = $username;
  109. return $this;
  110. }
  111. /**
  112. * Set password.
  113. *
  114. * @param string $password
  115. *
  116. * @return Agents
  117. */
  118. public function setPassword($password)
  119. {
  120. $this->password = $password;
  121. return $this;
  122. }
  123. /**
  124. * Set email.
  125. *
  126. * @param string $email
  127. *
  128. * @return Agents
  129. */
  130. public function setEmail($email)
  131. {
  132. $this->email = $email;
  133. return $this;
  134. }
  135. /**
  136. * Get email.
  137. *
  138. * @return string
  139. */
  140. public function getEmail()
  141. {
  142. return $this->email;
  143. }
  144. /**
  145. * Set isActive.
  146. *
  147. * @param bool $isActive
  148. *
  149. * @return Agents
  150. */
  151. public function setIsActive($isActive)
  152. {
  153. $this->isActive = $isActive;
  154. return $this;
  155. }
  156. /**
  157. * Get isActive.
  158. *
  159. * @return bool
  160. */
  161. public function getIsActive()
  162. {
  163. return $this->isActive;
  164. }
  165. public function isIsActive(): ?bool
  166. {
  167. return $this->isActive;
  168. }
  169. public function getDateUpdated(): ?\DateTimeInterface
  170. {
  171. return $this->dateUpdated;
  172. }
  173. public function setDateUpdated(\DateTimeInterface $dateUpdated): self
  174. {
  175. $this->dateUpdated = $dateUpdated;
  176. return $this;
  177. }
  178. public function getDateInserted(): ?\DateTimeInterface
  179. {
  180. return $this->dateInserted;
  181. }
  182. public function setDateInserted(\DateTimeInterface $dateInserted): self
  183. {
  184. $this->dateInserted = $dateInserted;
  185. return $this;
  186. }
  187. }