Guest User

Untitled

a guest
Sep 15th, 2011
854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Acme\UserBundle\Entity;
  4.  
  5. use Symfony\Component\Security\Core\User\UserInterface;
  6. use Doctrine\ORM\Mapping as ORM;
  7.  
  8. /**
  9. * Acme\UserBundle\Entity\User
  10. */
  11. class User implements UserInterface
  12. {
  13. function save($obj){
  14. $em = $obj->getDoctrine()->getEntityManager();
  15. $em->persist($this);
  16. $em->flush();
  17. }
  18.  
  19. function getRoles(){
  20. }
  21.  
  22. function getSalt(){
  23. return md5($this->getEmail);
  24. }
  25.  
  26. function getUserName(){
  27. return $this->getFirstName().' '.$this->getLastName();
  28. }
  29. function eraseCredentials(){
  30. }
  31.  
  32. function equals(UserInterface $user){
  33. return ($user->getEmail() === $this->getEmail()) && ($user->getPassword() === $this->getPassword());
  34. }
  35. /**
  36. * @var integer $id
  37. */
  38. private $id;
  39.  
  40. /**
  41. * @var string $first_name
  42. */
  43. private $first_name;
  44.  
  45. /**
  46. * @var string $last_name
  47. */
  48. private $last_name;
  49.  
  50. /**
  51. * @var string $email
  52. */
  53. private $email;
  54.  
  55.  
  56. /**
  57. * Get id
  58. *
  59. * @return integer
  60. */
  61. public function getId()
  62. {
  63. return $this->id;
  64. }
  65.  
  66. /**
  67. * Set first_name
  68. *
  69. * @param string $firstName
  70. */
  71. public function setFirstName($firstName)
  72. {
  73. $this->first_name = $firstName;
  74. }
  75.  
  76. /**
  77. * Get first_name
  78. *
  79. * @return string
  80. */
  81. public function getFirstName()
  82. {
  83. return $this->first_name;
  84. }
  85.  
  86. /**
  87. * Set last_name
  88. *
  89. * @param string $lastName
  90. */
  91. public function setLastName($lastName)
  92. {
  93. $this->last_name = $lastName;
  94. }
  95.  
  96. /**
  97. * Get last_name
  98. *
  99. * @return string
  100. */
  101. public function getLastName()
  102. {
  103. return $this->last_name;
  104. }
  105.  
  106. /**
  107. * Set email
  108. *
  109. * @param string $email
  110. */
  111. public function setEmail($email)
  112. {
  113. $this->email = $email;
  114. }
  115.  
  116. /**
  117. * Get email
  118. *
  119. * @return string
  120. */
  121. public function getEmail()
  122. {
  123. return $this->email;
  124. }
  125. /**
  126. * @var string $login
  127. */
  128. private $login;
  129.  
  130.  
  131. /**
  132. * @var string $password
  133. */
  134. private $password;
  135.  
  136.  
  137. /**
  138. * Set password
  139. *
  140. * @param string $password
  141. */
  142. public function setPassword($password)
  143. {
  144. $this->password = $password;
  145. }
  146.  
  147. /**
  148. * Get password
  149. *
  150. * @return string
  151. */
  152. public function getPassword()
  153. {
  154. return $this->password;
  155. }
  156. /**
  157. * @var smallint $role
  158. */
  159. private $role;
  160.  
  161.  
  162. /**
  163. * Set role
  164. *
  165. * @param smallint $role
  166. */
  167. public function setRole($role)
  168. {
  169. $this->role = $role;
  170. }
  171.  
  172. /**
  173. * Get role
  174. *
  175. * @return smallint
  176. */
  177. public function getRole()
  178. {
  179. return $this->role;
  180. }
  181. }
Advertisement
Add Comment
Please, Sign In to add comment