src/Entity/PublisherCabinet/MafoPublisherCabinetManager.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\PublisherCabinet;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Security\Core\User\UserInterface;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7. * @ORM\Entity(repositoryClass="App\Repository\MafoPublisherCabinetManagerRepository")
  8. * @ORM\Table(name="mafo_publisher_cabinet_manager")
  9. */
  10. class MafoPublisherCabinetManager implements UserInterface, \Serializable
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(type="string", unique=true)
  20. * @Assert\NotBlank
  21. * @Assert\Email
  22. */
  23. private $email;
  24. /**
  25. * @ORM\Column(type="string")
  26. * @Assert\NotBlank
  27. */
  28. private $firstName;
  29. /**
  30. * @ORM\Column(type="string", nullable=true)
  31. */
  32. private $lastName;
  33. /**
  34. * @ORM\Column(type="string", nullable=true)
  35. */
  36. private $password;
  37. /**
  38. * @ORM\Column(type="string")
  39. * @Assert\NotBlank
  40. */
  41. private $status;
  42. /**
  43. * @ORM\Column(type="datetime", nullable=true)
  44. */
  45. private $lastLoginAt;
  46. /**
  47. * @ORM\Column(type="datetime")
  48. * @Assert\NotBlank
  49. */
  50. private $dateUpdated;
  51. /**
  52. * @ORM\Column(type="datetime")
  53. * @Assert\NotBlank
  54. */
  55. private $dateInserted;
  56. // Getters
  57. public function getId(): ?int
  58. {
  59. return $this->id;
  60. }
  61. public function getEmail(): ?string
  62. {
  63. return $this->email;
  64. }
  65. public function getFirstName(): ?string
  66. {
  67. return $this->firstName;
  68. }
  69. public function getLastName(): ?string
  70. {
  71. return $this->lastName;
  72. }
  73. public function getPassword(): ?string
  74. {
  75. return $this->password;
  76. }
  77. public function getRoles(): array
  78. {
  79. return array('ROLE_MAFO_PUBLISHER');
  80. }
  81. public function getStatus(): ?string
  82. {
  83. return $this->status;
  84. }
  85. public function getLastLoginAt(): ?\DateTimeInterface
  86. {
  87. return $this->lastLoginAt;
  88. }
  89. public function getDateUpdated(): \DateTimeInterface
  90. {
  91. return $this->dateUpdated;
  92. }
  93. public function getDateInserted(): \DateTimeInterface
  94. {
  95. return $this->dateInserted;
  96. }
  97. // Setters
  98. public function setEmail(string $email): self
  99. {
  100. $this->email = $email;
  101. return $this;
  102. }
  103. public function setFirstName(string $firstName): self
  104. {
  105. $this->firstName = $firstName;
  106. return $this;
  107. }
  108. public function setLastName(?string $lastName): self
  109. {
  110. $this->lastName = $lastName;
  111. return $this;
  112. }
  113. public function setPassword(?string $password): self
  114. {
  115. $this->password = $password;
  116. return $this;
  117. }
  118. public function setStatus(string $status): self
  119. {
  120. $this->status = $status;
  121. return $this;
  122. }
  123. public function setLastLoginAt(?\DateTimeInterface $lastLoginAt): self
  124. {
  125. $this->lastLoginAt = $lastLoginAt;
  126. return $this;
  127. }
  128. public function setDateUpdated(\DateTimeInterface $dateUpdated): self
  129. {
  130. $this->dateUpdated = $dateUpdated;
  131. return $this;
  132. }
  133. public function setDateInserted(\DateTimeInterface $dateInserted): self
  134. {
  135. $this->dateInserted = $dateInserted;
  136. return $this;
  137. }
  138. // Add this method if it's not already implemented
  139. public function getUserIdentifier(): string
  140. {
  141. // Ensure email is not null
  142. return $this->email ?? '';
  143. }
  144. public function getSalt()
  145. {
  146. // TODO: Implement getSalt() method.
  147. }
  148. public function eraseCredentials()
  149. {
  150. // TODO: Implement eraseCredentials() method.
  151. }
  152. public function getUsername()
  153. {
  154. // TODO: Implement getUsername() method.
  155. }
  156. /** @see \Serializable::serialize() */
  157. public function serialize(): string
  158. {
  159. return serialize([
  160. $this->id,
  161. $this->email,
  162. $this->firstName,
  163. $this->lastName,
  164. $this->password,
  165. $this->status,
  166. $this->lastLoginAt ? $this->lastLoginAt->format('c') : null, // ISO 8601 date format
  167. ]);
  168. }
  169. /** @see \Serializable::unserialize() */
  170. public function unserialize($serialized): void
  171. {
  172. list(
  173. $this->id,
  174. $this->email,
  175. $this->firstName,
  176. $this->lastName,
  177. $this->password,
  178. $this->status,
  179. $lastLoginAtSerialized
  180. ) = unserialize($serialized, ['allowed_classes' => false]);
  181. $this->lastLoginAt = $lastLoginAtSerialized ? \DateTime::createFromFormat('c', $lastLoginAtSerialized) : null;
  182. }
  183. public function __call(string $name, array $arguments)
  184. {
  185. // TODO: Implement @method string getUserIdentifier()
  186. }
  187. }