Advertisement
whitestarrr

Untitled

Mar 27th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. <?php
  2.  
  3. namespace AppBundle\Entity;
  4.  
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Security\Core\User\UserInterface;
  8.  
  9. /**
  10. * User
  11. *
  12. * @ORM\Table(name="user")
  13. * @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
  14. */
  15. class User implements UserInterface
  16. {
  17. /**
  18. * @var int
  19. *
  20. * @ORM\Column(name="id", type="integer")
  21. * @ORM\Id
  22. * @ORM\GeneratedValue(strategy="AUTO")
  23. */
  24. private $id;
  25.  
  26. /**
  27. * @var string
  28. *
  29. * @ORM\Column(name="email", type="string", length=255, unique=true)
  30. */
  31. private $email;
  32.  
  33. /**
  34. * @var string
  35. *
  36. * @ORM\Column(name="fullName", type="string", length=255)
  37. */
  38. private $fullName;
  39.  
  40. /**
  41. * @var string
  42. *
  43. * @ORM\Column(name="password", type="string", length=255)
  44. */
  45. private $password;
  46.  
  47. /**
  48. * @var ArrayCollection
  49. *
  50. * @ORM\OneToMany(targetEntity="AppBundle\Entity\Article", mappedBy="author")
  51. */
  52. private $articles;
  53.  
  54. public function addPost(Article $article) {
  55. $this->articles[] = $article;
  56.  
  57. return $this;
  58. }
  59.  
  60. /**
  61. * @return \Doctrine\Common\Collections\Collection
  62. */
  63. public function getArticles()
  64. {
  65. return $this->articles;
  66. }
  67.  
  68. /**
  69. * Get id
  70. *
  71. * @return int
  72. */
  73. public function getId()
  74. {
  75. return $this->id;
  76. }
  77.  
  78. /**
  79. * Set email
  80. *
  81. * @param string $email
  82. *
  83. * @return User
  84. */
  85. public function setEmail($email)
  86. {
  87. $this->email = $email;
  88.  
  89. return $this;
  90. }
  91.  
  92. /**
  93. * Get email
  94. *
  95. * @return string
  96. */
  97. public function getEmail()
  98. {
  99. return $this->email;
  100. }
  101.  
  102. /**
  103. * Set fullName
  104. *
  105. * @param string $fullName
  106. *
  107. * @return User
  108. */
  109. public function setFullName($fullName)
  110. {
  111. $this->fullName = $fullName;
  112.  
  113. return $this;
  114. }
  115.  
  116. /**
  117. * Get fullName
  118. *
  119. * @return string
  120. */
  121. public function getFullName()
  122. {
  123. return $this->fullName;
  124. }
  125.  
  126. /**
  127. * Set password
  128. *
  129. * @param string $password
  130. *
  131. * @return User
  132. */
  133. public function setPassword($password)
  134. {
  135. $this->password = $password;
  136.  
  137. return $this;
  138. }
  139.  
  140. /**
  141. * Get password
  142. *
  143. * @return string
  144. */
  145. public function getPassword()
  146. {
  147. return $this->password;
  148. }
  149.  
  150. /**
  151. * Returns the roles granted to the user.
  152. *
  153. * <code>
  154. * public function getRoles()
  155. * {
  156. * return array('ROLE_USER');
  157. * }
  158. * </code>
  159. *
  160. * Alternatively, the roles might be stored on a ``roles`` property,
  161. * and populated in any number of different ways when the user object
  162. * is created.
  163. *
  164. * @return (Role|string)[] The user roles
  165. */
  166. public function getRoles()
  167. {
  168. return [];
  169. }
  170.  
  171. /**
  172. * Returns the salt that was originally used to encode the password.
  173. *
  174. * This can return null if the password was not encoded using a salt.
  175. *
  176. * @return string|null The salt
  177. */
  178. public function getSalt()
  179. {
  180. // TODO: Implement getSalt() method.
  181. }
  182.  
  183. /**
  184. * Returns the username used to authenticate the user.
  185. *
  186. * @return string The username
  187. */
  188. public function getUsername()
  189. {
  190. return $this->email;
  191. }
  192.  
  193. /**
  194. * Removes sensitive data from the user.
  195. *
  196. * This is important if, at any given point, sensitive information like
  197. * the plain-text password is stored on this object.
  198. */
  199. public function eraseCredentials()
  200. {
  201. // TODO: Implement eraseCredentials() method.
  202. }
  203.  
  204. public function __construct()
  205. {
  206. $this->articles = new ArrayCollection();
  207. }
  208. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement